Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.hp.hpl.jena.rdf.model
Interface Resource  view Resource download Resource.java

All Superinterfaces:
com.hp.hpl.jena.graph.FrontsNode, RDFNode
All Known Subinterfaces:
Alt, Bag, Container, Property, RDFList, ReifiedStatement, Seq

public interface Resource
extends RDFNode

An RDF Resource.

Resource instances when created are associated with a specific model. They 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.

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.

Version:
Release='$Name: $' Revision='$Revision: 1.14 $' Date='$Date: 2005/02/21 12:14:23 $'

Method Summary
 Resource abort()
          Abort the transaction in the associated model.
 Resource addProperty(Property p, boolean o)
          Add a property to this resource.
 Resource addProperty(Property p, char o)
          Add a property to this resource.
 Resource addProperty(Property p, double o)
          Add a property to this resource.
 Resource addProperty(Property p, float o)
          Add a property to this resource.
 Resource addProperty(Property p, long o)
          Add a property to this resource.
 Resource addProperty(Property p, java.lang.Object o)
          Add a property to this resource.
 Resource addProperty(Property p, RDFNode o)
          Add a property to this resource.
 Resource addProperty(Property p, java.lang.String o)
          Add a property to this resource.
 Resource addProperty(Property p, java.lang.String o, java.lang.String l)
          Add a property to this resource.
 Resource begin()
          Begin a transaction in the associated model.
 Resource commit()
          Commit the transaction in the associated model.
 boolean equals(java.lang.Object o)
          Determine whether two objects represent the same resource.
 AnonId getId()
          Returns an a unique identifier for anonymous resources.
 java.lang.String getLocalName()
          Returns the name of this resource within its namespace.
 Model getModel()
          Return the model associated with this resource.
 java.lang.String getNameSpace()
          Returns the namespace associated with this resource.
 com.hp.hpl.jena.graph.Node getNode()
          every Resource overlays a Node; fetch that Node.
 Statement getProperty(Property p)
          Answer some statement (this, p, O) in the associated model.
 Statement getRequiredProperty(Property p)
          Get a property value of this resource.
 java.lang.String getURI()
          Return the URI of the resource, or null if it's a bnode.
 boolean hasProperty(Property p)
          Determine whether this resource has any values for a given property.
 boolean hasProperty(Property p, boolean o)
          Test if this resource has a given property with a given value.
 boolean hasProperty(Property p, char o)
          Test if this resource has a given property with a given value.
 boolean hasProperty(Property p, double o)
          Test if this resource has a given property with a given value.
 boolean hasProperty(Property p, float o)
          Test if this resource has a given property with a given value.
 boolean hasProperty(Property p, long o)
          Test if this resource has a given property with a given value.
 boolean hasProperty(Property p, java.lang.Object o)
          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 hasProperty(Property p, java.lang.String o)
          Test if this resource has a given property with a given value.
 boolean hasProperty(Property p, java.lang.String o, java.lang.String l)
          Test if this resource has a given property with a given value.
 boolean hasURI(java.lang.String uri)
          Answer true iff this Resource is a URI resource with the given URI; otherwise answer false.
 boolean isAnon()
          Determine whether this resource is anonymous.
 StmtIterator listProperties()
          Return an iterator over all the properties of this resource.
 StmtIterator listProperties(Property p)
          List all the values of the property p.
 Resource removeAll(Property p)
          Delete all the statements with predicate p for this resource from its associated model.
 Resource removeProperties()
          Delete all the properties for this resource from the associated model.
 java.lang.String toString()
          Return a string representation of the resource.
 
Methods inherited from interface com.hp.hpl.jena.rdf.model.RDFNode
as, canAs, inModel, visitWith
 
Methods inherited from interface com.hp.hpl.jena.graph.FrontsNode
asNode
 

Method Detail

getId

public AnonId getId()
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.


getNode

public com.hp.hpl.jena.graph.Node getNode()
every Resource overlays a Node; fetch that Node.


hasURI

public boolean hasURI(java.lang.String uri)
Answer true iff this Resource is a URI resource with the given URI; otherwise answer false. Using this is preferred to using getURI() and .equals().


getURI

public java.lang.String getURI()
Return the URI of the resource, or null if it's a bnode.


getNameSpace

public java.lang.String getNameSpace()
Returns the namespace associated with this resource.


getLocalName

public java.lang.String getLocalName()
Returns the name of this resource within its namespace.


toString

public java.lang.String toString()
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.

Specified by:
toString in interface RDFNode

equals

public boolean equals(java.lang.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. 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.


isAnon

public boolean isAnon()
Determine whether this resource is anonymous.


getRequiredProperty

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. 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.


getProperty

public Statement getProperty(Property p)
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.


listProperties

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.


listProperties

public StmtIterator listProperties()
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.


addProperty

public Resource addProperty(Property p,
                            boolean 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.

o is converted to a string by calling its toString() method.


addProperty

public Resource addProperty(Property p,
                            long 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.

o is converted to a string by calling its toString() method.


addProperty

public Resource addProperty(Property p,
                            char 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.

o is converted to a string by calling its toString() method.


addProperty

public Resource addProperty(Property p,
                            float 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.

o is converted to a string by calling its toString() method.


addProperty

public Resource addProperty(Property p,
                            double 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.

o is converted to a string by calling its toString() method.


addProperty

public Resource addProperty(Property p,
                            java.lang.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.


addProperty

public Resource addProperty(Property p,
                            java.lang.String o,
                            java.lang.String l)
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.


addProperty

public Resource addProperty(Property p,
                            java.lang.Object 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.

o is converted to a string by calling its toString() method.


addProperty

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.


hasProperty

public boolean hasProperty(Property p)
Determine whether this resource has any values for a given property.


hasProperty

public boolean hasProperty(Property p,
                           boolean o)
Test if this resource has a given property with a given value.


hasProperty

public boolean hasProperty(Property p,
                           long o)
Test if this resource has a given property with a given value.


hasProperty

public boolean hasProperty(Property p,
                           char o)
Test if this resource has a given property with a given value.


hasProperty

public boolean hasProperty(Property p,
                           float o)
Test if this resource has a given property with a given value.


hasProperty

public boolean hasProperty(Property p,
                           double o)
Test if this resource has a given property with a given value.


hasProperty

public boolean hasProperty(Property p,
                           java.lang.String o)
Test if this resource has a given property with a given value.


hasProperty

public boolean hasProperty(Property p,
                           java.lang.String o,
                           java.lang.String l)
Test if this resource has a given property with a given value.


hasProperty

public boolean hasProperty(Property p,
                           java.lang.Object o)
Test if this resource has a given property with a given value.


hasProperty

public boolean hasProperty(Property p,
                           RDFNode o)
Test if this resource has a given property with a given value.


removeProperties

public Resource removeProperties()
Delete all the properties for this resource from the associated model.


removeAll

public Resource removeAll(Property p)
Delete all the statements with predicate p for this resource from its associated model.


begin

public Resource begin()
Begin a transaction in the associated model.


abort

public Resource abort()
Abort the transaction in the associated model.


commit

public Resource commit()
Commit the transaction in the associated model.


getModel

public Model getModel()
Return the model associated with this resource.