| com.hp.hpl.jena.rdf.model.Resource
All known Subclasses: com.hp.hpl.jena.rdf.model.impl.ResourceImpl,
Resource | public interface Resource extends RDFNode(Code) | | An RDF Resource.
Resource instances when created may be associated with a specific model.
Resources created by a model will refer to that model, and support
a range of methods, such as getProperty() and
addProperty() which will access or modify that model. This
enables the programmer to write code in a compact and easy style.
Resources created by ResourceFactory will not refer to any model, and will
not permit operations which require a model. Such resources are useful
as general constants.
This interface provides methods supporting typed literals. This means
that methods are provided which will translate a built in type, or an
object to an RDF Literal. This translation is done by invoking the
toString() method of the object, or its built in equivalent.
The reverse translation is also supported. This is built in for built
in types. Factory objects, provided by the application, are used
for application objects.
This interface provides methods for supporting enhanced resources. An
enhanced resource is a resource to which the application has added
behaviour. RDF containers are examples of enhanced resources built in
to this package. Enhanced resources are supported by encapsulating a
resource created by an implementation in another class which adds
the extra behaviour. Factory objects are used to construct such
enhanced resources.
author: bwm version: Release='$Name: $' Revision='$Revision: 1.28 $' Date='$Date: 2008/01/02 12:05:46 $' |
Method Summary | |
public Resource | abort() Abort the transaction in the associated model. | public Resource | addLiteral(Property p, boolean o) Add the property p with the typed-literal value o
to this resource, ie add (this, p, typed(o)) to this's model. | public Resource | addLiteral(Property p, long o) Add the property p with the typed-literal value o
to this resource, ie add (this, p, typed(o)) to this's model. | public Resource | addLiteral(Property p, char o) Add the property p with the typed-literal value o
to this resource, ie add (this, p, typed(o)) to this's model. | public Resource | addLiteral(Property value, double d) Add the property p with the typed-literal value o
to this resource, ie add (this, p, typed(o)) to this's model. | public Resource | addLiteral(Property value, float d) Add the property p with the typed-literal value o
to this resource, ie add (this, p, typed(o)) to this's model. | public Resource | addLiteral(Property p, Object o) Add the property p with the typed-literal value o
to this resource, ie add (this, p, typed(o)) to this's model. | public Resource | addProperty(Property p, String o) 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.
Parameters: p - The property to be added. Parameters: o - The value of the property to be added. | public Resource | addProperty(Property p, String o, String l) Add a property to this resource. | public Resource | addProperty(Property p, String lexicalForm, RDFDatatype datatype) Add a property to this resource. | public Resource | addProperty(Property p, RDFNode o) 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.
Parameters: p - The property to be added. Parameters: o - The value of the property to be added. | public Resource | begin() Begin a transaction in the associated model. | public Resource | commit() Commit the transaction in the associated model. | public boolean | equals(Object o) Determine whether two objects represent the same resource.
A resource can only be equal to another resource.
If both resources are not anonymous, then they are equal if the URI's are
equal. | public AnonId | getId() Returns an a unique identifier for anonymous resources.
The id is unique within the scope of a particular implementation. | public String | getLocalName() Returns the name of this resource within its namespace. | public Model | getModel() Return the model associated with this resource. | public String | getNameSpace() Returns the namespace associated with this resource. | public Node | getNode() Answer the underlying [SPI] Node of this Resource. | public Statement | getProperty(Property p) Answer some statement (this, p, O) in the associated model. | public Statement | getRequiredProperty(Property p) 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. | public String | getURI() Return the URI of the resource, or null if it's a bnode. | public boolean | hasLiteral(Property p, boolean o) Answer true iff this resource has the value o for
property p . | public boolean | hasLiteral(Property p, long o) Answer true iff this resource has the value o for
property p . | public boolean | hasLiteral(Property p, char o) Answer true iff this resource has the value o for
property p . | public boolean | hasLiteral(Property p, double o) Answer true iff this resource has the value o for
property p . | public boolean | hasLiteral(Property p, float o) Answer true iff this resource has the value o for
property p . | public boolean | hasLiteral(Property p, Object o) Answer true iff this resource has the value o for
property p . | public boolean | hasProperty(Property p) Determine whether this resource has any values for a given property.
Parameters: p - The property sought. | public boolean | hasProperty(Property p, String o) Test if this resource has a given property with a given value.
Parameters: p - The property sought. Parameters: o - The value of the property sought. | public boolean | hasProperty(Property p, String o, String l) Test if this resource has a given property with a given value.
Parameters: p - The property sought. Parameters: o - The value of the property sought. Parameters: l - The language of the property sought. | public boolean | hasProperty(Property p, RDFNode o) Test if this resource has a given property with a given value.
Parameters: p - The property sought. Parameters: o - The value of the property sought. | public boolean | hasURI(String uri) Answer true iff this Resource is a URI resource with the given URI. | public StmtIterator | listProperties(Property p) 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.
Parameters: p - The predicate sought. | public StmtIterator | listProperties() Return an iterator over all the properties of this resource. | public Resource | removeAll(Property p) Delete all the statements with predicate p for this resource
from its associated model. | public Resource | removeProperties() Delete all the properties for this resource from the associated model. | public String | toString() Return a string representation of the resource. |
abort | public Resource abort()(Code) | | Abort the transaction in the associated model.
This resource to permit cascading. |
addLiteral | public Resource addLiteral(Property p, boolean o)(Code) | | Add the property p with the typed-literal value o
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 using
this.getModel().createTypedLiteral(o) .
|
addLiteral | public Resource addLiteral(Property p, long o)(Code) | | Add the property p with the typed-literal value o
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 using
this.getModel().createTypedLiteral(o) .
|
addLiteral | public Resource addLiteral(Property p, char o)(Code) | | Add the property p with the typed-literal value o
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 using
this.getModel().createTypedLiteral(o) .
|
addLiteral | public Resource addLiteral(Property value, double d)(Code) | | Add the property p with the typed-literal value o
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 using
this.getModel().createTypedLiteral(o) .
|
addLiteral | public Resource addLiteral(Property value, float d)(Code) | | Add the property p with the typed-literal value o
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 using
this.getModel().createTypedLiteral(o) .
|
addLiteral | public Resource addLiteral(Property p, Object o)(Code) | | Add the property p with the typed-literal value o
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 using
this.getModel().createTypedLiteral(o) .
|
addProperty | public Resource addProperty(Property p, String o)(Code) | | 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.
Parameters: p - The property to be added. Parameters: o - The value of the property to be added. This resource to allow cascading calls. |
addProperty | public Resource addProperty(Property p, String o, String l)(Code) | | 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.
Parameters: p - The property to be added. Parameters: o - The value of the property to be added. Parameters: l - the language of the property This resource to allow cascading calls. |
addProperty | public Resource addProperty(Property p, String lexicalForm, RDFDatatype datatype)(Code) | | 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.
Parameters: p - The property to be added. Parameters: lexicalForm - The lexical form of the literal Parameters: datatype - The datatype This resource to allow cascading calls. |
addProperty | public Resource addProperty(Property p, RDFNode o)(Code) | | 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.
Parameters: p - The property to be added. Parameters: o - The value of the property to be added. This resource to allow cascading calls. |
begin | public Resource begin()(Code) | | Begin a transaction in the associated model.
This resource to permit cascading. |
commit | public Resource commit()(Code) | | Commit the transaction in the associated model.
This resource to permit cascading. |
equals | public boolean equals(Object o)(Code) | | Determine whether two objects represent the same resource.
A resource can only be equal to another resource.
If both resources are not anonymous, then they are equal if the URI's are
equal. If both resources are anonymous, they are equal only if there Id's
are the same. If one resource is anonymous and the other is not, then they
are not equal.
Parameters: o - The object to be compared. true if and only if both objects are equal |
getId | public AnonId getId()(Code) | | 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.
A unique id for an anonymous resource. |
getLocalName | public String getLocalName()(Code) | | Returns the name of this resource within its namespace.
The name of this property within its namespace. |
getModel | public Model getModel()(Code) | | Return the model associated with this resource. If the Resource
was not created by a Model, the result may be null.
The model associated with this resource. |
getNameSpace | public String getNameSpace()(Code) | | Returns the namespace associated with this resource.
The namespace for this property. |
getNode | public Node getNode()(Code) | | Answer the underlying [SPI] Node of this Resource.
|
getProperty | public Statement getProperty(Property p)(Code) | | 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.
Parameters: p - the property sought a statement (this, p, O), or null if no such statements exist here |
getRequiredProperty | public Statement getRequiredProperty(Property p)(Code) | | 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.
Parameters: p - The property sought. some (this, p, ?O) statement if one exists throws: PropertyNotFoundException - if no such statement found |
getURI | public String getURI()(Code) | | Return the URI of the resource, or null if it's a bnode.
The URI of the resource, or null if it's a bnode. |
hasLiteral | public boolean hasLiteral(Property p, boolean o)(Code) | | Answer true iff this resource has the value o for
property p . o is interpreted as
a typed literal with the appropriate RDF type.
|
hasLiteral | public boolean hasLiteral(Property p, long o)(Code) | | Answer true iff this resource has the value o for
property p . o is interpreted as
a typed literal with the appropriate RDF type.
|
hasLiteral | public boolean hasLiteral(Property p, char o)(Code) | | Answer true iff this resource has the value o for
property p . o is interpreted as
a typed literal with the appropriate RDF type.
|
hasLiteral | public boolean hasLiteral(Property p, double o)(Code) | | Answer true iff this resource has the value o for
property p . o is interpreted as
a typed literal with the appropriate RDF type.
|
hasLiteral | public boolean hasLiteral(Property p, float o)(Code) | | Answer true iff this resource has the value o for
property p . o is interpreted as
a typed literal with the appropriate RDF type.
|
hasLiteral | public boolean hasLiteral(Property p, Object o)(Code) | | Answer true iff this resource has the value o for
property p . o is interpreted as
a typed literal with the appropriate RDF type.
|
hasProperty | public boolean hasProperty(Property p)(Code) | | Determine whether this resource has any values for a given property.
Parameters: p - The property sought. true if and only if this resource has at least onevalue for the property. |
hasProperty | public boolean hasProperty(Property p, String o)(Code) | | Test if this resource has a given property with a given value.
Parameters: p - The property sought. Parameters: o - The value of the property sought. true if and only if this resource has property p withvalue o. |
hasProperty | public boolean hasProperty(Property p, String o, String l)(Code) | | Test if this resource has a given property with a given value.
Parameters: p - The property sought. Parameters: o - The value of the property sought. Parameters: l - The language of the property sought. true if and only if this resource has property p withvalue o. |
hasProperty | public boolean hasProperty(Property p, RDFNode o)(Code) | | Test if this resource has a given property with a given value.
Parameters: p - The property sought. Parameters: o - The value of the property sought. true if and only if this resource has property p withvalue o. |
hasURI | public boolean hasURI(String uri)(Code) | | Answer true iff this Resource is a URI resource with the given URI.
Using this is preferred to using getURI() and .equals().
|
listProperties | public StmtIterator listProperties(Property p)(Code) | | 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.
Parameters: p - The predicate sought. An iterator over the statements. |
listProperties | public StmtIterator listProperties()(Code) | | 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.
An iterator over all the statements about this object. |
removeAll | public Resource removeAll(Property p)(Code) | | Delete all the statements with predicate p for this resource
from its associated model.
Parameters: p - the property to remove this resource, to permit cascading |
removeProperties | public Resource removeProperties()(Code) | | Delete all the properties for this resource from the associated model.
This resource to permit cascading. |
toString | public String toString()(Code) | | 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.
Return a string representation of the resource.if it is anonymous. |
|
|