Package org.apache.jena.rdf.model
Interface RDFNode
- All Superinterfaces:
FrontsNode
- All Known Subinterfaces:
AllDifferent
,AllValuesFromRestriction
,Alt
,AnnotationProperty
,Bag
,BooleanClassDescription
,CardinalityQRestriction
,CardinalityRestriction
,ComplementClass
,Container
,DataRange
,DatatypeProperty
,EnumeratedClass
,FunctionalProperty
,HasValueRestriction
,Individual
,IntersectionClass
,InverseFunctionalProperty
,Literal
,MaxCardinalityQRestriction
,MaxCardinalityRestriction
,MinCardinalityQRestriction
,MinCardinalityRestriction
,ObjectProperty
,OntClass
,Ontology
,OntProperty
,OntResource
,Property
,QualifiedRestriction
,RDFList
,ReifiedStatement
,Resource
,Restriction
,Seq
,SomeValuesFromRestriction
,SymmetricProperty
,TransitiveProperty
,UnionClass
- All Known Implementing Classes:
AllDifferentImpl
,AllValuesFromRestrictionImpl
,AltImpl
,AnnotationPropertyImpl
,BagImpl
,BooleanClassDescriptionImpl
,CardinalityQRestrictionImpl
,CardinalityRestrictionImpl
,ComplementClassImpl
,ContainerImpl
,DataRangeImpl
,DatatypePropertyImpl
,EnumeratedClassImpl
,FunctionalPropertyImpl
,HasValueRestrictionImpl
,IndividualImpl
,IntersectionClassImpl
,InverseFunctionalPropertyImpl
,LiteralImpl
,MaxCardinalityQRestrictionImpl
,MaxCardinalityRestrictionImpl
,MinCardinalityQRestrictionImpl
,MinCardinalityRestrictionImpl
,ObjectPropertyImpl
,OntClassImpl
,OntologyImpl
,OntPropertyImpl
,OntResourceImpl
,PropertyImpl
,QualifiedRestrictionImpl
,RDFListImpl
,ReifiedStatementImpl
,ResourceImpl
,RestrictionImpl
,SeqImpl
,SomeValuesFromRestrictionImpl
,SymmetricPropertyImpl
,TransitivePropertyImpl
,UnionClassImpl
Interface covering RDF resources and literals. Allows probing whether a
node is a literal/[blank, URI]resource, moving nodes from model to model,
and viewing them as different Java types using the .as() polymorphism.
-
Method Summary
Modifier and TypeMethodDescription<T extends RDFNode>
TRDFNodes can be converted to different implementation types.If this node is a Literal, answer that literal; otherwise throw an exception.If this node is a Resource, answer that resource; otherwise throw an exception.<T extends RDFNode>
booleanAnswer true iff this RDFNode can be viewed as an instance ofview
: that is, if it has already been viewed in this way, or if it has an attached model in which it has properties that permit it to be viewed in this way.getModel()
Return the model associated with this resource.Answer a .equals() version of this node, except that it's in the modelm
.boolean
isAnon()
Answer true iff this RDFNode is an anonymous resource.boolean
Answer true iff this RDFNode is a literal resource.boolean
Answer true iff this RDFNode is a URI resource or an anonymous resource or a statement term (ie is not a literal).boolean
Answer true iff this RDFNode is a resource representing an RDF-star triple term.boolean
Answer true iff this RDFNode is an named resource.toString()
Answer a String representation of the node.visitWith
(RDFVisitor rv) Apply the appropriate method of the visitor to this node's content and return the result.Methods inherited from interface org.apache.jena.graph.FrontsNode
asNode
-
Method Details
-
toString
String toString()Answer a String representation of the node. The form of the string depends on the type of the node and is intended for human consumption, not machine analysis. -
isAnon
boolean isAnon()Answer true iff this RDFNode is an anonymous resource. Useful for one-off tests: see also visitWith() for making literal/anon/URI choices. -
isLiteral
boolean isLiteral()Answer true iff this RDFNode is a literal resource. Useful for one-off tests: see also visitWith() for making literal/anon/URI choices. -
isURIResource
boolean isURIResource()Answer true iff this RDFNode is an named resource. Useful for one-off tests: see also visitWith() for making literal/anon/URI choices. -
isResource
boolean isResource()Answer true iff this RDFNode is a URI resource or an anonymous resource or a statement term (ie is not a literal). Useful for one-off tests: see also visitWith() for making literal/anon/URI choices. -
isStmtResource
boolean isStmtResource()Answer true iff this RDFNode is a resource representing an RDF-star triple term. -
as
RDFNodes can be converted to different implementation types. Convert this RDFNode to a type supporting theview
interface. The resulting RDFNode should be an instance ofview
and should have any internal invariants as specified.If the RDFNode has no Model attached, it can only be .as()ed to a type it (this particular RDFNOde) already has.
If the RDFNode cannot be converted, an UnsupportedPolymorphism exception is thrown..
-
canAs
Answer true iff this RDFNode can be viewed as an instance ofview
: that is, if it has already been viewed in this way, or if it has an attached model in which it has properties that permit it to be viewed in this way. IfcanAs
returnstrue
,as
on the same view should deliver an instance of that class. -
getModel
Model getModel()Return the model associated with this resource. If the Resource was not created by a Model, the result may be null.- Returns:
- The model associated with this resource.
-
inModel
Answer a .equals() version of this node, except that it's in the modelm
.- Parameters:
m
- a model to move the node to- Returns:
- this, if it's already in m (or no model), a copy in m otherwise
-
visitWith
Apply the appropriate method of the visitor to this node's content and return the result.- Parameters:
rv
- an RDFVisitor with a method for URI/blank/literal nodes- Returns:
- the result returned by the selected method
-
asResource
Resource asResource()If this node is a Resource, answer that resource; otherwise throw an exception. -
asLiteral
Literal asLiteral()If this node is a Literal, answer that literal; otherwise throw an exception.
-