|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
An RDF Model.
An RDF model is a set of Statements. Methods are provided for creating resources, properties and literals and the Statements which link them, for adding statements to and removing them from a model, for querying a model and set operations for combining models.
This interface defines a set of primitive methods. A set of
convenience methods which extends this interface, e.g. performing
automatic type conversions and support for enhanced resources,
is defined in ModelCon.
Some of the methods, e.g. the read methods, may have to traverse a firewall. This can be accomplished using the standard java method of setting system properties. To use a socks proxy, include on the java command line:
-DsocksProxyHost=[your-proxy-domain-name-or-ip-address]
To use an http proxy, include on the command line:
-DproxySet=true -DproxyHost=[your-proxy] -DproxyPort=[your-proxy-port-number]
Alternatively, these properties can be set programatically, e.g.
System.getProperties().put("proxySet","true");
System.getProperties().put("proxyHost","proxy.hostname");
System.getProperties().put("proxyPort",port_number);
| Method Summary | |
Model |
abort()
Abort the current transaction and abandon any changes in progress. |
Model |
add(Model m)
Add all the statements in another model to this model. |
Model |
add(Statement s)
Add a statement to this model. |
Model |
add(StmtIterator iter)
Add all the statements returned by an iterator to this model. |
Model |
begin()
Begin a new transation. |
void |
close()
Close the Model and free up resources held. |
Model |
commit()
Commit the current transaction. |
boolean |
contains(Resource s,
Property p)
Determine whether this model contains any statements with a given subject and property. |
boolean |
contains(Resource s,
Property p,
RDFNode o)
Determine if a statement is present in this model. |
boolean |
contains(Statement s)
Determine if a statement is present in this model. |
boolean |
containsAll(Model model)
Determine if all of the statements in a model are also contained in this model. |
boolean |
containsAll(StmtIterator iter)
Determine if all of the statements returned by an iterator are contained in this model. |
boolean |
containsAny(Model model)
Determine if any of the statements in a model are also contained in this model. |
boolean |
containsAny(StmtIterator iter)
Determine if any of the statements returned by an iterator are contained in this model. |
Literal |
createLiteral(java.lang.String v,
java.lang.String language)
create a literal from a String value with a specified language |
Literal |
createLiteral(java.lang.String v,
java.lang.String language,
boolean wellFormed)
create a literal from a String value with a specified language |
Property |
createProperty(java.lang.String nameSpace,
java.lang.String localName)
Create a property |
Resource |
createResource()
Create a new anonymous resource. |
Resource |
createResource(java.lang.String uri)
Create a new resource. |
Statement |
createStatement(Resource s,
Property p,
RDFNode o)
Create a Statement instance. |
Model |
difference(Model model)
Create a new model containing all the statements in this model which are not in another. |
boolean |
equals(java.lang.Object model)
Test whether one model is the equal to another. |
Statement |
getProperty(Resource s,
Property p)
Return a statement with given subject and property. |
Property |
getProperty(java.lang.String nameSpace,
java.lang.String localName)
Return a Property instance in this model. |
Resource |
getResource(java.lang.String uri)
Return a Resource instance in this model. |
boolean |
independent()
Determine whether this model is independent. |
Model |
intersection(Model model)
Create a new model containing all the statements which are in both this model and another. |
boolean |
isReified(Statement s)
Determine if this statement is the subject of any statements in this model |
NsIterator |
listNameSpaces()
List all namespaces of predicates in the model. |
NodeIterator |
listObjects()
List all objects in a model. |
NodeIterator |
listObjectsOfProperty(Property p)
List all objects of a given property. |
NodeIterator |
listObjectsOfProperty(Resource s,
Property p)
List the values of a property of a resource. |
StmtIterator |
listReifiedStatements()
List all reified statements in the model. |
StmtIterator |
listStatements()
List all statements. |
StmtIterator |
listStatements(Selector s)
List the statements matching a selector. |
ResIterator |
listSubjects()
List all resources which are subjects of statements. |
ResIterator |
listSubjectsWithProperty(Property p)
List all subjects with a given property. |
ResIterator |
listSubjectsWithProperty(Property p,
RDFNode o)
List all subjects with a given property and property value |
Model |
query(Selector s)
Create a new model containing the statements matching a query. |
Model |
read(java.io.Reader reader,
java.lang.String base)
add statements from an RDF/XML serialization |
Model |
read(java.io.Reader reader,
java.lang.String base,
java.lang.String lang)
add RDF statements represented in language lang to the model. |
Model |
read(java.lang.String url)
Add the RDF statements from an XML document. |
Model |
read(java.lang.String url,
java.lang.String lang)
add statements from a serializion in language lang to
the model. |
Model |
remove(Statement s)
Removes a statement. |
long |
size()
computes the number of statements in the model. |
boolean |
supportsSetOperations()
Determine whether this model supports set operations. |
boolean |
supportsTransactions()
Determine whether this model supports transactions. |
Model |
union(Model model)
Create a new model containing all the statements in this model together with all of those in another given model. |
Model |
write(java.io.Writer writer)
Write the model as an XML document. |
Model |
write(java.io.Writer writer,
java.lang.String lang)
write a serialized represention of a model in a specified language. |
Model |
write(java.io.Writer writer,
java.lang.String lang,
java.lang.String base)
write a serialized represention of a model in a specified language. |
| Methods inherited from interface com.hp.hpl.mesa.rdf.jena.model.ModelCon |
add, add, add, add, add, add, add, add, add, add, add, add, contains, contains, contains, contains, contains, contains, contains, contains, createAlt, createAlt, createBag, createBag, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createProperty, createResource, createResource, createResource, createResource, createSeq, createSeq, createStatement, createStatement, createStatement, createStatement, createStatement, createStatement, createStatement, createStatement, createStatement, createStatement, getAlt, getAlt, getBag, getBag, getProperty, getResource, getSeq, getSeq, listSubjectsWithProperty, listSubjectsWithProperty, listSubjectsWithProperty, listSubjectsWithProperty, listSubjectsWithProperty, listSubjectsWithProperty, listSubjectsWithProperty, listSubjectsWithProperty, remove, remove |
| Methods inherited from interface com.hp.hpl.mesa.rdf.jena.model.RDFReaderF |
getReader, getReader, setReaderClassName |
| Methods inherited from interface com.hp.hpl.mesa.rdf.jena.model.RDFWriterF |
getWriter, getWriter, setWriterClassName |
| Method Detail |
public long size()
throws RDFException
RDFException - Generic RDF Exception
public ResIterator listSubjects()
throws RDFException
Subsequent operations on those resource may modify this model.
RDFException - Generic RDF Exception
public NsIterator listNameSpaces()
throws RDFException
RDFException - Generic RDF Exception
public StmtIterator listStatements()
throws RDFException
Subsequent operations on those statements may modify this model.
RDFException - Generic RDF Exception
public StmtIterator listReifiedStatements()
throws RDFException
Subsequent operations on those statements may modify this model.
RDFException - Generic RDF Exception
public Resource getResource(java.lang.String uri)
throws RDFException
Subsequent operations on the returned object may modify this model.
This method should be called if the resource may already exist in the
model so that an implementation may reuse the same object. If it does
not an object will be created. If it is known that an object for the
resource does not already exist, then it may be more efficient to call
createResource instead.
uri - the URI of the resource
RDFException - Generic RDF exception.
public Property getProperty(java.lang.String nameSpace,
java.lang.String localName)
throws RDFException
Subsequent operations on the returned property may modify this model.
This method should be called if the property may already exist in the
model so that an implementation may reuse the same object. If it does
not an object will be created. If it is known that an object for the
property does not already exist, then it may be more efficient to call
createProperty instead.
nameSpace - the RDF namespace of the propertylocalName - the localName of the property in its namespace
RDFException - Generic RDF Exception
public Resource createResource()
throws RDFException
Subsequent operations on the returned resource may modify this model.
RDFException - Generic RDF exception.
public Resource createResource(java.lang.String uri)
throws RDFException
Subsequent operations on the returned resource may modify this model.
uri - the URI of the resource to be created
RDFException - Generic RDF exception.
public Property createProperty(java.lang.String nameSpace,
java.lang.String localName)
throws RDFException
Subsequent operations on the returned property may modify this model.
nameSpace - the nameSpace of the propertylocalName - the name of the property within its namespace
RDFException - Generic RDF exception
public Literal createLiteral(java.lang.String v,
java.lang.String language)
throws RDFException
If v is null, then a literal with an empty string is created.
v - the value of the literallanguage - the language associated with the literal
RDFException - generic RDF exception
public Literal createLiteral(java.lang.String v,
java.lang.String language,
boolean wellFormed)
throws RDFException
If v is null, then a literal with an empty string is created.
v - the value of the literallanguage - the language associated with the literalwellFormed - true if the Literal is well formed XML
RDFException - generic RDF exception
public Statement createStatement(Resource s,
Property p,
RDFNode o)
throws RDFException
Subsequent operations on the statement or any of its parts will modify this model.
Creating a statement does not add it to the set of statements in the model.
s - the subject of the statementp - the predicate of the statemento - the object of the statement
RDFException - generic RDF exception
public Model add(Statement s)
throws RDFException
s - The statement to be added.
RDFException - Generic RDF Exception
public Model add(StmtIterator iter)
throws RDFException
iter - An iterator which returns the statements to be added.
RDFException - Generic RDF Exception
public Model add(Model m)
throws RDFException
m - The model whose statements are to be added.
RDFException - Generic RDF Exception
public Model read(java.lang.String url)
throws RDFException
See Model for a description of how to traverse a firewall.
url - of the document containing the RDF statements.
RDFException - Generic RDF Exception
public Model read(java.io.Reader reader,
java.lang.String base)
throws RDFException
reader - the source of the RDF/XMLbase - the base to use when converting relative to absolute uri's
RDFException - a generic RDF exception
public Model read(java.lang.String url,
java.lang.String lang)
throws RDFException
lang to
the model.
predefined values for lang are "RDF/XML", "N-TRIPLE" and
"N3". null represents the default language, "RDF/XML".
See Model for a description of how to traverse a firewall.
url - a string representation of the url to read fromlang - the language of the serialization
RDFException - generic RDF exception
public Model read(java.io.Reader reader,
java.lang.String base,
java.lang.String lang)
throws RDFException
lang to the model.
predefined values for lang are defined in RDFReader
base - the base uri to be used when converting relative
URI's to absolute URI's.lang - the langauge of the serialization null
selects the defaultreader - the source of the input serialization
- Returns:
- this model
- Throws:
RDFException - generic exception
public Model write(java.io.Writer writer)
throws RDFException
The language in which to write the model is specified by the
lang argument. Predefined values are "RDF/XML",
"RDF/XML-ABBREV", "N-TRIPLE" and "N3". The default value is
represented by null is "RDF/XML".
writer - a writer to which the XML will be written
RDFException - Generic RDF Exception
public Model write(java.io.Writer writer,
java.lang.String lang)
throws RDFException
The language in which to write the model is specified by the
lang argument. Predefined values are "RDF/XML",
"RDF/XML-ABBREV", "N-TRIPLE" and "N3". The default value is
represented by null is "RDF/XML".
writer - the output writerlang - the output langauge
RDFException - generic exception
public Model write(java.io.Writer writer,
java.lang.String lang,
java.lang.String base)
throws RDFException
Predefine languages are defined in RDFWriterF
writer - the output writerbase - the base uri for relative URI calculations.
null means use only absolute URI's.lang - the language in which the RDF should be written
RDFException - generic RDF exception
public Model remove(Statement s)
throws RDFException
The statement with the same subject, predicate and object as that supplied will be removed from the model.
s - The statement to be removed.
RDFException - Generic RDF Exception
public Statement getProperty(Resource s,
Property p)
throws RDFException
If more than one statement witht the given subject and property exists in the model, it is undefined which will be returned.
s - The subject of the statement to be returned.p - The property of the statement to be returned.
RDFException - Generic RDF Exception
public ResIterator listSubjectsWithProperty(Property p)
throws RDFException
p - the property sought.
RDFException - Generic RDF Exception
public ResIterator listSubjectsWithProperty(Property p,
RDFNode o)
throws RDFException
p - The predicate soughto - The value sought
RDFException - Generic RDF Exception
public NodeIterator listObjects()
throws RDFException
RDFException - Generic RDF Exception
public NodeIterator listObjectsOfProperty(Property p)
throws RDFException
p - The predicate sought
RDFException - Generic RDF Exception
public NodeIterator listObjectsOfProperty(Resource s,
Property p)
throws RDFException
p - The predicate sought
RDFException - Generic RDF Exception
public boolean contains(Resource s,
Property p)
throws RDFException
s - The subject sought.p - The predicate sought.
RDFException - Generic RDF Exception
public boolean contains(Resource s,
Property p,
RDFNode o)
throws RDFException
s - The subject of the statment tested.p - The predicate of the statement tested.o - The object of the statement tested.
RDFException - Generic RDF Exception
public boolean contains(Statement s)
throws RDFException
s - The statement tested.
RDFException - Generic RDF Exception
public boolean containsAny(StmtIterator iter)
throws RDFException
iter - an iterator of the statements to be tested
RDFException - Generic RDF Exception
public boolean containsAll(StmtIterator iter)
throws RDFException
iter - an iterator of the statements to be tested
RDFException - Generic RDF Exception
public boolean containsAny(Model model)
throws RDFException
model - the model containing the statements to be tested
RDFException - Generic RDF Exception
public boolean containsAll(Model model)
throws RDFException
model - the model containing the statements to be tested
RDFException - Generic RDF Exception
public boolean isReified(Statement s)
throws RDFException
s - The statement tested.
RDFException - Generic RDF Exception
public StmtIterator listStatements(Selector s)
throws RDFException
A statment is considered to match if the test method
of s returns true when called on s.
s - A selector object.
RDFException - Generic RDF exception.
public Model query(Selector s)
throws RDFException
A statment is considered to match if the test method
of s returns true when called on s.
s - A selector object.
RDFException - Generic RDF exception.
public Model union(Model model)
throws RDFException
model - The other model whose statements are to be included.
RDFException - Generic RDF Exception
public Model intersection(Model model)
throws RDFException
model - The other model.
RDFException - Generic RDF Exception
public Model difference(Model model)
throws RDFException
model - the other model whose statements are to be excluded.
RDFException - Generic RDF Exceptionpublic boolean equals(java.lang.Object model)
Two models are considered equal when each statement in one can be matched with a statement in the other. Statements which are identical match.
Special treatment is given to anonymous nodes. A binding is a one to
one mapping which maps each anonymous node in this model to
an anonymous node in model. Two statements s1 and s2 match
under a binding if if s1.subject is anonymous and s2.subject is anonymous
and the binding maps s1.subject to s2.subject.
Two models are equal if there is a binding that allows all the statements in one model to match a a statement in the other.
equals in class java.lang.Objectmodel - the model to be compared
public Model begin()
throws RDFException
All changes made to a model within a transaction, will either be made, or none of them will be made.
RDFException - Generic RDF Exception
public Model abort()
throws RDFException
RDFException - Generic RDF Exception
public Model commit()
throws RDFException
RDFException - Generic RDF Exceptionpublic boolean independent()
For efficiency reasons, some implementations may create models which which are dependent on others, i.e. a change in one model may cause a change in another. If this is the case this method will return false, otherwise it will return true.
public boolean supportsTransactions()
public boolean supportsSetOperations()
public void close()
Not all implementations of Model require this method to be called. But some do, so in general its best to call it when done with the object, rather than leave it to the finalizer.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||