- All Implemented Interfaces:
FrontsNode
,RDFNode
,Resource
- Direct Known Subclasses:
ContainerImpl
,OntResourceImpl
,PropertyImpl
,RDFListImpl
,ReifiedStatementImpl
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates new ResourceImplResourceImpl
(String uri) ResourceImpl
(String nameSpace, String localName) ResourceImpl
(String nameSpace, String localName, ModelCom m) ResourceImpl
(String uri, ModelCom m) ResourceImpl
(Node n, EnhGraph m) ResourceImpl
(Node n, ModelCom m) the main constructor: make a new Resource in the given model, rooted in the given node.ResourceImpl
(AnonId id) ResourceImpl
(AnonId id, ModelCom m) ResourceImpl
(Resource r, ModelCom m) ResourceImpl
(Statement statement, ModelCom m) -
Method Summary
Modifier and TypeMethodDescriptionabort()
Abort the transaction in the associated model.addLiteral
(Property p, boolean o) Add the propertyp
with the typed-literal valueo
to this resource, ie add (this, p, typed(o)) to this's model.addLiteral
(Property p, char o) Add the propertyp
with the typed-literal valueo
to this resource, ie add (this, p, typed(o)) to this's model.addLiteral
(Property p, double o) Add the propertyp
with the typed-literal valueo
to this resource, ie add (this, p, typed(o)) to this's model.addLiteral
(Property p, float o) Add the propertyp
with the typed-literal valueo
to this resource, ie add (this, p, typed(o)) to this's model.addLiteral
(Property p, long o) Add the propertyp
with the typed-literal valueo
to this resource, ie add (this, p, typed(o)) to this's model.addLiteral
(Property p, Object o) Add the propertyp
with the typed-literal valueo
to this resource, ie add (this, p, typed(o)) to this's model.addLiteral
(Property p, Literal o) Add the propertyp
with the pre-constructed Literal valueo
to this resource, ie add (this, p, o) to this's model.addProperty
(Property p, double o) addProperty
(Property p, float o) addProperty
(Property p, long o) addProperty
(Property p, String o) Add a property to this resource.addProperty
(Property p, String o, String l) Add a property to this resource.addProperty
(Property p, String lexicalForm, RDFDatatype datatype) Add a property to this resource.addProperty
(Property p, RDFNode o) Add a property to this resource.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.begin()
Begin a transaction in the associated model.commit()
Commit the transaction in the associated model.getId()
Returns an a unique identifier for anonymous resources.Returns the localname of this resource within its namespace if it is a URI else null.getModel()
Return the model associated with this resource.Returns the namespace associated with this resource if it is a URI, else return null.Answer some statement (this, p, O) in the associated model.getProperty
(Property p, String lang) Answer some statement (this, p, O), in languagelang
, in the associated model.Answer some resource R for which this.hasProperty( p, R ), or null if no such R exists.Get a property value of this resource.getRequiredProperty
(Property p, String lang) Get a property value of this resource in a specified language.Return the statement of this resource, or null if it is not an RDF-star triple term.getURI()
Return the URI of the resource, or null if it's a bnode or statement.boolean
hasLiteral
(Property p, boolean o) Answer true iff this resource has the valueo
for propertyp
.boolean
hasLiteral
(Property p, char o) Answer true iff this resource has the valueo
for propertyp
.boolean
hasLiteral
(Property p, double o) Answer true iff this resource has the valueo
for propertyp
.boolean
hasLiteral
(Property p, float o) Answer true iff this resource has the valueo
for propertyp
.boolean
hasLiteral
(Property p, long o) Answer true iff this resource has the valueo
for propertyp
.boolean
hasLiteral
(Property p, Object o) Answer true iff this resource has the valueo
for propertyp
.boolean
Determine whether this resource has any values for a given property.boolean
hasProperty
(Property p, String o) Test if this resource has a given property with a given value.boolean
hasProperty
(Property p, String o, String l) Test if this resource has a given property with a given value.boolean
hasProperty
(Property p, RDFNode o) Test if this resource has a given property with a given value.boolean
Answer true iff this Resource is a URI resource with the given URI.Override RDFNode.inModel() to produce a statically-typed Resource in the given Model.Return an iterator over all the properties of this resource.List all the values of the property p.listProperties
(Property p, String lang) Return an iterator over all the properties of this resource with a specific language.Delete all the statements with predicatep
for this resource from its associated model.Delete all the properties for this resource from the associated model.toString()
Return a string representation of the resource.visitWith
(RDFVisitor rv) Apply the appropriate method of the visitor to this node's content and return the result.Methods inherited from class org.apache.jena.enhanced.EnhNode
as, asNode, canAs, equals, getGraph, hashCode, isAnon, isLiteral, isResource, isStmtResource, isURIResource, isValid, viewAs
Methods inherited from class org.apache.jena.enhanced.Polymorphic
addView, supports
Methods inherited from interface org.apache.jena.graph.FrontsNode
asNode
Methods inherited from interface org.apache.jena.rdf.model.RDFNode
as, canAs, isAnon, isLiteral, isResource, isStmtResource, isURIResource
-
Field Details
-
factory
-
rdfNodeFactory
-
-
Constructor Details
-
ResourceImpl
the main constructor: make a new Resource in the given model, rooted in the given node. NOT FOR PUBLIC USE - used in ModelCom [and ContainerImpl] -
ResourceImpl
public ResourceImpl()Creates new ResourceImpl -
ResourceImpl
-
ResourceImpl
-
ResourceImpl
-
ResourceImpl
-
ResourceImpl
-
ResourceImpl
-
ResourceImpl
-
ResourceImpl
-
ResourceImpl
-
ResourceImpl
-
-
Method Details
-
visitWith
Description copied from interface:RDFNode
Apply the appropriate method of the visitor to this node's content and return the result. -
asResource
Description copied from interface:RDFNode
If this node is a Resource, answer that resource; otherwise throw an exception.- Specified by:
asResource
in interfaceRDFNode
-
asLiteral
Description copied from interface:RDFNode
If this node is a Literal, answer that literal; otherwise throw an exception. -
inModel
Description copied from interface:Resource
Override RDFNode.inModel() to produce a statically-typed Resource in the given Model. -
getId
Description copied from interface:Resource
Returns an a unique identifier for anonymous resources.The id is unique within the scope of a particular implementation. All models within an implementation will use the same id for the same anonymous resource.
This method is undefined if called on resources which are not anonymous and may raise an exception.
-
getURI
Description copied from interface:Resource
Return the URI of the resource, or null if it's a bnode or statement. -
getStmtTerm
Description copied from interface:Resource
Return the statement of this resource, or null if it is not an RDF-star triple term. This is not a resource for a reified statement.- Specified by:
getStmtTerm
in interfaceResource
- Returns:
- The statement of this resource,or null if it is not an RDF-star triple term.
-
getNameSpace
Description copied from interface:Resource
Returns the namespace associated with this resource if it is a URI, else return null.The namespace is suitable for use with localname in in RDF/XML. XML does not allow QNames to start with a digit and this method reflects that restriction in the values for namespace and localname.
See functions in
SplitIRI
for other split algorithms.- Specified by:
getNameSpace
in interfaceResource
- Returns:
- The namespace for this resource or null.
-
getLocalName
Description copied from interface:Resource
Returns the localname of this resource within its namespace if it is a URI else null.Note: XML requires QNames to start with a letter, not a digit, and this method reflects that restriction.
See functions in
SplitIRI
for other split algorithms.- Specified by:
getLocalName
in interfaceResource
- Returns:
- The localname of this property within its namespace.
-
hasURI
Description copied from interface:Resource
Answer true iff this Resource is a URI resource with the given URI. Using this is preferred to using getURI() and .equals(). -
toString
Description copied from interface:Resource
Return a string representation of the resource. Returns the URI of the resource unless the resource is anonymous in which case it returns the id of the resource enclosed in square brackets. -
getRequiredProperty
Description copied from interface:Resource
Get a property value of this resource.The model associated with the resource instance is searched for statements whose subject is this resource and whose predicate is p. If such a statement is found, it is returned. If several such statements are found, any one may be returned. If no such statements are found, an exception is thrown.
- Specified by:
getRequiredProperty
in interfaceResource
- Parameters:
p
- The property sought.- Returns:
- some (this, p, ?O) statement if one exists
-
getRequiredProperty
Description copied from interface:Resource
Get a property value of this resource in a specified language.The model associated with the resource instance is searched for statements whose subject is this resource and whose predicate is p. If such a statement is found, it is returned. If several such statements are found, any one may be returned. If no such statements are found, an exception is thrown.
- Specified by:
getRequiredProperty
in interfaceResource
- Parameters:
p
- The property sought.lang
- The language of the statement with the property sought.- Returns:
- some (this, p, ?O@lang) statement if one exists
-
getProperty
Description copied from interface:Resource
Answer some statement (this, p, O) in the associated model. If there are several such statements, any one of them may be returned. If no such statements exist, null is returned - in this is differs from getRequiredProperty.- Specified by:
getProperty
in interfaceResource
- Parameters:
p
- the property sought- Returns:
- a statement (this, p, O), or null if no such statements exist here
-
getProperty
Description copied from interface:Resource
Answer some statement (this, p, O), in languagelang
, in the associated model. If there are several such statements, any one of them may be returned. If no such statements exist, null is returned - in this it differs from getRequiredProperty.- Specified by:
getProperty
in interfaceResource
- Parameters:
p
- The property sought.lang
- The language of the property sought.- Returns:
- some (this, p, ?O@lang) statement if one exists
-
listProperties
Description copied from interface:Resource
List all the values of the property p.Returns an iterator over all the statements in the associated model whose subject is this resource and whose predicate is p.
- Specified by:
listProperties
in interfaceResource
- Parameters:
p
- The predicate sought.- Returns:
- An iterator over the statements.
-
listProperties
Description copied from interface:Resource
Return an iterator over all the properties of this resource with a specific language.The model associated with this resource is searched and an iterator is returned which iterates over all the statements which have this resource as a subject.
- Specified by:
listProperties
in interfaceResource
- Returns:
- An iterator over all the statements about this object.
-
listProperties
Description copied from interface:Resource
Return an iterator over all the properties of this resource.The model associated with this resource is search and an iterator is returned which iterates over all the statements which have this resource as a subject.
- Specified by:
listProperties
in interfaceResource
- Returns:
- An iterator over all the statements about this object.
-
addLiteral
Description copied from interface:Resource
Add the propertyp
with the typed-literal valueo
to this resource, ie add (this, p, typed(o)) to this's model. Answer this resource. The typed literal is equal to one constructed by usingthis.getModel().createTypedLiteral(o)
.- Specified by:
addLiteral
in interfaceResource
-
addProperty
-
addLiteral
Description copied from interface:Resource
Add the propertyp
with the typed-literal valueo
to this resource, ie add (this, p, typed(o)) to this's model. Answer this resource. The typed literal is equal to one constructed by usingthis.getModel().createTypedLiteral(o)
.- Specified by:
addLiteral
in interfaceResource
-
addLiteral
Description copied from interface:Resource
Add the propertyp
with the typed-literal valueo
to this resource, ie add (this, p, typed(o)) to this's model. Answer this resource. The typed literal is equal to one constructed by usingthis.getModel().createTypedLiteral(o)
.- Specified by:
addLiteral
in interfaceResource
-
addProperty
-
addProperty
-
addLiteral
Description copied from interface:Resource
Add the propertyp
with the typed-literal valueo
to this resource, ie add (this, p, typed(o)) to this's model. Answer this resource. The typed literal is equal to one constructed by usingthis.getModel().createTypedLiteral(o)
.- Specified by:
addLiteral
in interfaceResource
-
addLiteral
Description copied from interface:Resource
Add the propertyp
with the typed-literal valueo
to this resource, ie add (this, p, typed(o)) to this's model. Answer this resource. The typed literal is equal to one constructed by usingthis.getModel().createTypedLiteral(o)
.- Specified by:
addLiteral
in interfaceResource
-
addProperty
Description copied from interface:Resource
Add a property to this resource.A statement with this resource as the subject, p as the predicate and o as the object is added to the model associated with this resource.
- Specified by:
addProperty
in interfaceResource
- Parameters:
p
- The property to be added.o
- The value of the property to be added.- Returns:
- This resource to allow cascading calls.
-
addProperty
Description copied from interface:Resource
Add a property to this resource.A statement with this resource as the subject, p as the predicate and o as the object is added to the model associated with this resource.
- Specified by:
addProperty
in interfaceResource
- Parameters:
p
- The property to be added.o
- The value of the property to be added.l
- the language of the property- Returns:
- This resource to allow cascading calls.
-
addProperty
Description copied from interface:Resource
Add a property to this resource.A statement with this resource as the subject, p as the predicate and o as the object is added to the model associated with this resource.
- Specified by:
addProperty
in interfaceResource
- Parameters:
p
- The property to be added.lexicalForm
- The lexical form of the literaldatatype
- The datatype- Returns:
- This resource to allow cascading calls.
-
addLiteral
Description copied from interface:Resource
Add the propertyp
with the typed-literal valueo
to this resource, ie add (this, p, typed(o)) to this's model. Answer this resource. The typed literal is equal to one constructed by usingthis.getModel().createTypedLiteral(o)
.- Specified by:
addLiteral
in interfaceResource
-
addLiteral
Description copied from interface:Resource
Add the propertyp
with the pre-constructed Literal valueo
to this resource, ie add (this, p, o) to this's model. Answer this resource. NOTE thjat this is distinct from the other addLiteral methods in that the Literal is not turned into a Literal.- Specified by:
addLiteral
in interfaceResource
-
addProperty
Description copied from interface:Resource
Add a property to this resource.A statement with this resource as the subject, p as the predicate and o as the object is added to the model associated with this resource.
- Specified by:
addProperty
in interfaceResource
- Parameters:
p
- The property to be added.o
- The value of the property to be added.- Returns:
- This resource to allow cascading calls.
-
hasProperty
Description copied from interface:Resource
Determine whether this resource has any values for a given property.- Specified by:
hasProperty
in interfaceResource
- Parameters:
p
- The property sought.- Returns:
- true if and only if this resource has at least one value for the property.
-
hasLiteral
Description copied from interface:Resource
Answer true iff this resource has the valueo
for propertyp
.o
is interpreted as a typed literal with the appropriate RDF type.- Specified by:
hasLiteral
in interfaceResource
-
hasLiteral
Description copied from interface:Resource
Answer true iff this resource has the valueo
for propertyp
.o
is interpreted as a typed literal with the appropriate RDF type.- Specified by:
hasLiteral
in interfaceResource
-
hasLiteral
Description copied from interface:Resource
Answer true iff this resource has the valueo
for propertyp
.o
is interpreted as a typed literal with the appropriate RDF type.- Specified by:
hasLiteral
in interfaceResource
-
hasLiteral
Description copied from interface:Resource
Answer true iff this resource has the valueo
for propertyp
.o
is interpreted as a typed literal with the appropriate RDF type.- Specified by:
hasLiteral
in interfaceResource
-
hasLiteral
Description copied from interface:Resource
Answer true iff this resource has the valueo
for propertyp
.o
is interpreted as a typed literal with the appropriate RDF type.- Specified by:
hasLiteral
in interfaceResource
-
hasProperty
Description copied from interface:Resource
Test if this resource has a given property with a given value.- Specified by:
hasProperty
in interfaceResource
- Parameters:
p
- The property sought.o
- The value of the property sought.- Returns:
- true if and only if this resource has property p with value o.
-
hasProperty
Description copied from interface:Resource
Test if this resource has a given property with a given value.- Specified by:
hasProperty
in interfaceResource
- Parameters:
p
- The property sought.o
- The value of the property sought.l
- The language of the property sought.- Returns:
- true if and only if this resource has property p with value o.
-
hasLiteral
Description copied from interface:Resource
Answer true iff this resource has the valueo
for propertyp
.o
is interpreted as a typed literal with the appropriate RDF type.- Specified by:
hasLiteral
in interfaceResource
-
hasProperty
Description copied from interface:Resource
Test if this resource has a given property with a given value.- Specified by:
hasProperty
in interfaceResource
- Parameters:
p
- The property sought.o
- The value of the property sought.- Returns:
- true if and only if this resource has property p with value o.
-
removeProperties
Description copied from interface:Resource
Delete all the properties for this resource from the associated model.- Specified by:
removeProperties
in interfaceResource
- Returns:
- This resource to permit cascading.
-
removeAll
Description copied from interface:Resource
Delete all the statements with predicatep
for this resource from its associated model. -
begin
Description copied from interface:Resource
Begin a transaction in the associated model. -
abort
Description copied from interface:Resource
Abort the transaction in the associated model. -
commit
Description copied from interface:Resource
Commit the transaction in the associated model. -
getModel
Description copied from interface:RDFNode
Return the model associated with this resource. If the Resource was not created by a Model, the result may be null. -
getPropertyResourceValue
Description copied from interface:Resource
Answer some resource R for which this.hasProperty( p, R ), or null if no such R exists.- Specified by:
getPropertyResourceValue
in interfaceResource
-