📄 ontresource.java
字号:
*/
public boolean hasRDFType( Resource ontClass, boolean direct );
/**
* <p>
* Answer true if this resource is a member of the class denoted by the
* given class resource. Includes all available types, so is equivalent to
* <code><pre>
* hasRDF( ontClass, false );
* </pre></code>
* </p>
*
* @param ontClass Denotes a class to which this value may belong
* @return True if this resource has the given class as one of its <code>rdf:type</code>'s.
*/
public boolean hasRDFType( Resource ontClass );
/**
* <p>Remove the statement that this resource is of the given RDF type. If this statement
* is not true of the current model, nothing happens.</p>
* @param cls A resource denoting a class that that is to be removed from the classes of this resource
*/
public void removeRDFType( Resource cls );
/**
* <p>
* Answer true if this resource is a member of the class denoted by the
* given URI.</p>
*
* @param uri Denotes the URI of a class to which this value may belong
* @return True if this resource has the given class as one of its <code>rdf:type</code>'s.
*/
public boolean hasRDFType( String uri );
// other utility methods
/**
* <p>Answer the cardinality of the given property on this resource. The cardinality
* is the number of distinct values there are for the property.</p>
* @param p A property
* @return The cardinality for the property <code>p</code> on this resource, as an
* integer greater than or equal to zero.
*/
public int getCardinality( Property p );
/**
* <p>
* Set the value of the given property of this ontology resource to the given
* value, encoded as an RDFNode. Maintains the invariant that there is
* at most one value of the property for a given resource, so existing
* property values are first removed. To add multiple properties, use
* {@link #addProperty( Property, RDFNode ) addProperty}.
* </p>
*
* @param property The property to update
* @param value The new value of the property as an RDFNode, or null to
* effectively remove this property.
*/
public void setPropertyValue( Property property, RDFNode value );
/**
* <p>Answer the value of a given RDF property for this resource, or null
* if it doesn't have one. The value is returned as an RDFNode, from which
* the concrete data value can be extracted for literals. If the value is
* a resource, it will present the {@link OntResource} facet.
* If there is more than one RDF
* statement with the given property for the current value, it is not defined
* which of the values will be returned.</p>
*
* @param property An RDF property
* @return An RDFNode whose value is the value, or one of the values, of the
* given property. If the property is not defined the method returns null.
*/
public RDFNode getPropertyValue( Property property );
/**
* <p>Answer an iterator over the values for a given RDF property. Each
* value in the iterator will be an {@link RDFNode}.</p>
*
* @param property The property whose values are sought
* @return An Iterator over the values of the property
*/
public NodeIterator listPropertyValues( Property property );
/**
* <p>Remove the specific property-value pair from this resource.</p>
*
* @param property The property to be removed
* @param value The specific value of the property to be removed
*/
public void removeProperty( Property property, RDFNode value );
/**
* <p>Removes this resource from the ontology by deleting any statements that refer to it,
* as either statement-subject or statement-object.
* If this resource is a property, this method will <strong>not</strong> remove statements
* whose predicate is this property.</p>
* <p><strong>Caveat:</strong> Jena RDF models contain statements, not resources <em>per se</em>,
* so this method simulates removal of an object by removing all of the statements that have
* this resource as subject or object, with one exception. If the resource is referenced
* in an RDF List, i.e. as the object of an <code>rdf:first</code> statement in a list cell,
* this reference is <strong>not</strong> removed. Removing an arbitrary <code>rdf:first</code>
* statement from the midst of a list, without doing other work to repair the list, would
* leave an ill-formed list in the model. Therefore, if this resource is known to appear
* in a list somewhere in the model, it should be separately deleted from that list before
* calling this remove method.
* </p>
*/
public void remove();
// Conversion methods
/**
* <p>Answer a view of this resource as a property</p>
* @return This resource, but viewed as an OntProperty
* @exception ConversionException if the resource cannot be converted to a property
*/
public OntProperty asProperty();
/**
* <p>Answer a view of this resource as an annotation property</p>
* @return This resource, but viewed as an AnnotationProperty
* @exception ConversionException if the resource cannot be converted to an annotation property
*/
public AnnotationProperty asAnnotationProperty();
/**
* <p>Answer a view of this resource as an object property</p>
* @return This resource, but viewed as an ObjectProperty
* @exception ConversionException if the resource cannot be converted to an object property
*/
public ObjectProperty asObjectProperty();
/**
* <p>Answer a view of this resource as a datatype property</p>
* @return This resource, but viewed as a DatatypeProperty
* @exception ConversionException if the resource cannot be converted to a datatype property
*/
public DatatypeProperty asDatatypeProperty();
/**
* <p>Answer a view of this resource as an individual</p>
* @return This resource, but viewed as an Individual
* @exception ConversionException if the resource cannot be converted to an individual
*/
public Individual asIndividual();
/**
* <p>Answer a view of this resource as a class</p>
* @return This resource, but viewed as an OntClass
* @exception ConversionException if the resource cannot be converted to a class
*/
public OntClass asClass();
/**
* <p>Answer a view of this resource as an ontology description node</p>
* @return This resource, but viewed as an Ontology
* @exception ConversionException if the resource cannot be converted to an ontology description node
*/
public Ontology asOntology();
/**
* <p>Answer a view of this resource as a data range</p>
* @return This resource, but viewed as a DataRange
* @exception ConversionException if the resource cannot be converted to a data range
*/
public DataRange asDataRange();
/**
* <p>Answer a view of this resource as an 'all different' declaration</p>
* @return This resource, but viewed as an AllDifferent node
* @exception ConversionException if the resource cannot be converted to an all different declaration
*/
public AllDifferent asAllDifferent();
// Conversion test methods
/**
* <p>Answer true if this resource can be viewed as a property</p>
* @return True if this resource can be viewed as an OntProperty
*/
public boolean isProperty();
/**
* <p>Answer true if this resource can be viewed as an annotation property</p>
* @return True if this resource can be viewed as an AnnotationProperty
*/
public boolean isAnnotationProperty();
/**
* <p>Answer true if this resource can be viewed as an object property</p>
* @return True if this resource can be viewed as an ObjectProperty
*/
public boolean isObjectProperty();
/**
* <p>Answer true if this resource can be viewed as a datatype property</p>
* @return True if this resource can be viewed as a DatatypeProperty
*/
public boolean isDatatypeProperty();
/**
* <p>Answer true if this resource can be viewed as an individual</p>
* @return True if this resource can be viewed as an Individual
*/
public boolean isIndividual();
/**
* <p>Answer true if this resource can be viewed as a class</p>
* @return True if this resource can be viewed as an OntClass
*/
public boolean isClass();
/**
* <p>Answer true if this resource can be viewed as an ontology description node</p>
* @return True if this resource can be viewed as an Ontology
*/
public boolean isOntology();
/**
* <p>Answer true if this resource can be viewed as a data range</p>
* @return True if this resource can be viewed as a DataRange
*/
public boolean isDataRange();
/**
* <p>Answer true if this resource can be viewed as an 'all different' declaration</p>
* @return True if this resource can be viewed as an AllDifferent node
*/
public boolean isAllDifferent();
}
/*
(c) Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007 Hewlett-Packard Development Company, LP
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -