- All Implemented Interfaces:
Model,ModelCon,ModelGraphInterface,RDFReaderF,RDFWriterF,Lock,PrefixMapping
- Direct Known Subclasses:
InfModelImpl,MonitorModel,OntModelImpl
This class implements common methods, mainly convenience methods, for model implementations. It is intended use is as a base class from which model implementations can be derived.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.jena.shared.PrefixMapping
PrefixMapping.Factory, PrefixMapping.IllegalPrefixException, PrefixMapping.JenaLockedException -
Field Summary
Fields inherited from interface org.apache.jena.shared.PrefixMapping
Extended, Standard -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabort()Abort the current transaction and abandon any changes in progress.Answer a GraphListener that, when fed graph-level update events, fires the corresponding model-level event handlers inL.Add all the statements to the model by converting the list to an array of Statement and removing that.Add all the statements in another model to this model.add a statement to this model.add a statement to this model.add a statement to this model.add(Resource s, Property p, String lex, RDFDatatype datatype) add a statement to this model.add a statement to this model.add a Statement to this Model by adding its SPO components.Add all the statements to the model by converting them to an array of corresponding triples and removing those from the underlying graph.add(StmtIterator iter) Add all the statements returned by an iterator to this model.addLiteral(Resource s, Property p, boolean o) Add the statement (s, p, createTypedLiteral( o )) to this model and answer this model.addLiteral(Resource s, Property p, char o) Add the statement (s, p, createTypedLiteral( o )) to this model and answer this model.addLiteral(Resource s, Property p, double o) Add the statement (s, p, o') to the model, where o' is the typed literal corresponding to o.addLiteral(Resource s, Property p, float o) Add the statement (s, p, o') to the model, where o' is the typed literal corresponding to o.addLiteral(Resource s, Property p, int o) Add the statement (s, p, createTypedLiteral( o )) to this model and answer this model.addLiteral(Resource s, Property p, long o) Add the statement (s, p, createTypedLiteral( o )) to this model and answer this model.addLiteral(Resource s, Property p, Literal o) add a statement to this model.static voidService method to update the namespaces of a Model given the mappings from prefix names to sets of URIs.static NodeAnswer an RDF node wrappingnsuitably; URI nodes become Resources with the same URI, blank nodes become Resources with URI null but the same AnonId, and literal nodes become Literals withnas their value carrier.Answer a Statement in this Model which encodes the given Triple.asStatements(Iterator<Triple> it) asStatements(List<Triple> triples) asStatements(Triple[] triples) begin()Begin a new transaction.<T> TcalculateInTxn(Supplier<T> action) Execute the supplieractionwithin a transaction.Clear this prefix mapping of all mappingsvoidclose()Close the Model and free up resources held.commit()Commit the current transaction.booleanDetermine whether this model contains any statements with a given subject and property.booleanDetermine if a statement is present in this model.booleanDetermine if a statement is present in this model.booleanDetermine if a statement is present in this model.booleanDetermine if an (S, P, O) pattern is present in this model, with null allowed to represent a wildcard match.booleanDetermine if a statement is present in this model.booleancontainsAll(Model model) Determine if all of the statements in a model are also contained in this model.booleancontainsAll(StmtIterator iter) Determine if all of the statements returned by an iterator are contained in this model.booleancontainsAny(Model model) Determine if any of the statements in a model are also contained in this model.booleancontainsAny(StmtIterator iter) Determine if any of the statements returned by an iterator are contained in this model.booleancontainsLiteral(Resource s, Property p, boolean o) Answer true iff this model contains the statement (s, p, o') where o' is the typed literal corresponding to the value o.booleancontainsLiteral(Resource s, Property p, char o) Answer true iff this model contains the statement (s, p, o') where o' is the typed literal corresponding to the value o.booleancontainsLiteral(Resource s, Property p, double o) Answer true iff this model contains the statement (s, p, o') where o' is the typed literal corresponding to the value o.booleancontainsLiteral(Resource s, Property p, float o) Answer true iff this model contains (s, p, o') where o' is the typed literal corresponding to o.booleancontainsLiteral(Resource s, Property p, int o) Answer true iff this model contains the statement (s, p, o') where o' is the typed literal corresponding to the value o.booleancontainsLiteral(Resource s, Property p, long o) Answer true iff this model contains the statement (s, p, o') where o' is the typed literal corresponding to the value o.booleancontainsLiteral(Resource s, Property p, Object o) Answer true iff this model contains the statement (s, p, o') where o' is the typed literal corresponding to the value o.booleandetermine if the RDFNode r appears in any statement of this model.Create a new anonymous alt.Create a new alt.Create a new anonymous bag.Create a new bag.Answer a (the) new empty list Until this is made the object or subject in the model, it will not appear in a written form.createList(Iterator<? extends RDFNode> members) Answer a new list containing the resources from the given iterator, in order.createList(RDFNode... members) Answer a new list containing the RDF nodes from the given array, in ordercreate a literal from a String value.createLiteral(String v, String l) Create an untyped literal from a String value with a specified language.createLiteral(String v, String l, String d) Create an untyped literal from a String value with a specified language.createLiteralStatement(Resource r, Property p, boolean o) Answer a new Statement object (s, p, o') where o' is the typed literal corresponding to o using createTypedLiteral.createLiteralStatement(Resource r, Property p, char o) Answer a new Statement object (s, p, o') where o' is the typed literal corresponding to o using createTypedLiteral.createLiteralStatement(Resource r, Property p, double o) Answer a new Statement object (s, p, o') where o' is the typed literal corresponding to o using createTypedLiteral.createLiteralStatement(Resource r, Property p, float o) Answer a new Statement object (s, p, o') where o' is the typed literal corresponding to o using createTypedLiteral.createLiteralStatement(Resource r, Property p, int o) Answer a new Statement object (s, p, o') where o' is the typed literal corresponding to o using createTypedLiteral.createLiteralStatement(Resource r, Property p, long o) Answer a new Statement object (s, p, o') where o' is the typed literal corresponding to o using createTypedLiteral.createLiteralStatement(Resource r, Property p, Object o) Answer a new Statement object (s, p, o') where o' is the typed literal corresponding to o using createTypedLiteral.createProperty(String uri) Create a property.createProperty(String nameSpace, String localName) Create a property with a given URI composed from a namespace part and a localname part by concatenating the strings.Create a new anonymous resource whose model is this model.createResource(String uri) Create a new resource associated with this model.createResource(String uri, Resource type) Create a new resource with a given type.createResource(AnonId anonId) Create a blank node resource with a specified identifier.createResource(Resource type) Create a new anonymous resource with a given type.Create a new anonymous seq.Create a new seq.createStatement(Resource r, Property p, String o) Create a Statement instance.createStatement(Resource r, Property p, String o, String l) Create a Statement instance.createStatement(Resource r, Property p, RDFNode o) create a Statement from the given r, p, and o.createStatementTerm(Statement statement) Create an RDFNode for a statement.createTypedLiteral(boolean v) create a type literal from a boolean value.createTypedLiteral(char v) create a typed literal from a char value.createTypedLiteral(double v) create a typed literal from a double value.createTypedLiteral(float v) create a typed literal from a float value.createTypedLiteral(int v) create a typed literal from an integer value.createTypedLiteral(long v) create a typed literal from a long integer value.createTypedLiteral(Object value) Build a typed literal label from its value form using whatever datatype is currently registered as the the default representation for this java class.createTypedLiteral(Object value, String typeURI) Build a typed literal from its value form.createTypedLiteral(Object value, RDFDatatype dtype) Build a typed literal from its value form.create a typed literal from a String value.createTypedLiteral(String lex, String typeURI) Build a typed literal from its lexical form.createTypedLiteral(String lex, RDFDatatype dtype) Build a typed literal from its lexical form.Create a typed literal xsd:dateTime from a Calendar object.difference(Model model) Create a new, independent, model containing all the statements in this model which are not in another.voidenterCriticalSection(boolean requestReadLock) Enter a critical section.voidexecuteInTxn(Runnable action) Execute the runnableactionwithin a transaction.expandPrefix(String prefixed) Expand the uri using the prefix mappings if possible.Return an Alt instance in this model.Return an Alt instance based on a given resource.Return a Bag instance in this model.Return a bag instance based on a given resource.getGraph()Answer the Graph which this Model is presenting.Return a RDF List instance in this model.Return a RDF List based on a given resource.getLock()Get the model lock for this model.Return a copy of the internal mapping from names to URI strings.getNsPrefixURI(String prefix) Get the URI bound to a specific prefix, null if there isn't one.getNsURIPrefix(String uri) Answer the prefix for the given URI, or null if there isn't one.getProperty(String uri) Return a Property instance in this model.getProperty(String nameSpace, String localName) Return a Property instance with the given URI in this model.getProperty(Resource s, Property p) Answer a statement (s, p, ?getProperty(Resource s, Property p, String lang) Answer a statement (s, p, ?getRDFNode(Node n) return an RDFReader instance for the specified serialization language.Return a statement with given subject and property.getRequiredProperty(Resource s, Property p, String lang) Return a statement with given subject and property.getResource(String uri) Return a Resource instance with the given URI in this model.getResource(AnonId id) Return a Resource instance with the given URI in this model.Return a Seq instance in this model.Return a Seq instance based on a given resource.Get the model's writer after priming it with the model's namespace prefixes.booleanReturn whether the prefix mapping has any defined prefixes.booleanDetermine whether this model is independent.static ModelAnswer a Model that is the intersection of the two argument models.intersection(Model other) Intersect this with another model.booleanisClosed()Answer true iff .close() has been called on this Model.booleanisEmpty()Answer true iff the model contains no explicit statements (ie it's size is zero, listStatements() would deliver the empty iterator).booleanAnswer whether or not these two graphs are isomorphic.voidLeave a critical section.listBySubject(Container cont) listLiteralStatements(Resource S, Property P, boolean O) Answer a statement iterator that will iterate over all the statements (S, P, O) in this model where S matchessubject, P matchespredicate, and O matches the typed literal corresponding toobject.listLiteralStatements(Resource S, Property P, char O) Answer a statement iterator that will iterate over all the statements (S, P, O) in this model where S matchessubject, P matchespredicate, and O matches the typed literal corresponding toobject.listLiteralStatements(Resource S, Property P, double O) Answer a statement iterator that will iterate over all the statements (S, P, O) in this model where S matchessubject, P matchespredicate, and O matches the typed literal corresponding toobject.listLiteralStatements(Resource S, Property P, float O) Answer a statement iterator that will iterate over all the statements (S, P, O) in this model where S matchessubject, P matchespredicate, and O matches the typed literal corresponding toobject.listLiteralStatements(Resource S, Property P, int O) Answer a statement iterator that will iterate over all the statements (S, P, O) in this model where S matchessubject, P matchespredicate, and O matches the typed literal corresponding toobject.listLiteralStatements(Resource S, Property P, long O) Answer a statement iterator that will iterate over all the statements (S, P, O) in this model where S matchessubject, P matchespredicate, and O matches the typed literal corresponding toobject.(You probably don't want this method; more likely you want the PrefixMapping methods that Model supports.)List all objects in a model.List all objects of a given property. .remove() is not implemented on this iterator.List the values of a property of a resource.Answer an iterator [with no duplicates] over all the resources in this model that have propertyp.listResourcesWithProperty(Property p, boolean o) Answer an iterator [without duplicates] over all the resources in this model which have value o' for property p, where o' is the typed literal corresponding to o.listResourcesWithProperty(Property p, char o) Answer an iterator [without duplicates] over all the resources in this model which have value o' for property p, where o' is the typed literal corresponding to o.listResourcesWithProperty(Property p, double o) Answer an iterator [without duplicates] over all the resources in this model which have value o' for property p, where o' is the typed literal corresponding to o.listResourcesWithProperty(Property p, float o) Answer an iterator [without duplicates] over all the resources in this model which have value o' for property p, where o' is the typed literal corresponding to o.listResourcesWithProperty(Property p, long o) Answer an iterator [without duplicates] over all the resources in this model which have value o' for property p, where o' is the typed literal corresponding to o.Answer an iterator [without duplicates] over all the resources in this model which have value o' for property p, where o' is the typed literal corresponding to o.Answer an iterator [with no duplicates] over all the resources in this model that have propertypwith valueo.List all statements.listStatements(Resource S, Property P, String O) Find all the statements matching a pattern.listStatements(Resource S, Property P, String O, String L) Find all the statements matching a pattern.Find all the statements matching a pattern.listStatements(Resource S, Property P, RDFNode O) Find all the statements matching a pattern.List all resources which are subjects of statements.An alias forlistResourcesWithProperty(Property), retained for backward compatibility.lists all subjects with a given property and property value.listSubjectsWithProperty(Property p, String o, String l) lists all subjects with a given property and property value.listSubjectsWithProperty(Property p, String o, String l, String d) lists all subjects with a given property and property value.An alias forlistResourcesWithProperty, retained for backward compatibility.lock()Lock the PrefixMapping so that changes can no longer be made to it.Notify any listeners that the event e has occurred.intReturn the number of defined prefixes.Answer a qname with the expansion of the given uri, or null if no such qname can be constructed using the mapping's prefixes.read(InputStream reader, String base) Add statements from a document.read(InputStream reader, String base, String lang) Add RDF statements represented in languagelangto the model.Using this method is often a mistake.Using this method is often a mistake.Add the RDF statements from a document.Add statements from a serializion in languagelangto the model.Read into this model the RDF aturl, usingbaseURIas the base URI if it is non-null.register(ModelChangedListener listener) Register the listener with this model by registering its GraphListener adaption with the underlying Graph.Remove all the Statements from the model by converting the List to a List(Statement) and removing that.Remove all the Statements in a given model, including reified statementsremove the statement(s, p, o)from this model and answer this model.Removes a statement.remove all the Statements from the model by converting them to triples and removing those triples from the underlying graph.remove(StmtIterator iter) Remove all the Statements returned by an iterator.Remove all the statements from this model.Remove all the statements matching (s, p, o) from this model.removeNsPrefix(String prefix) Remove any existing maplet with the given prefix name and answer this mapping.booleansamePrefixMappingAs(PrefixMapping other) Answer true iff this prefix-mappings are equal, that is, map the same prefixes to the same URIs; same as this.getNsPrefixMap().equals( other.getNsPrefixMap() ) except that it may avoid unnecessary Map creations.setNsPrefix(String prefix, String uri) Specify the prefix name for a URI prefix string.setNsPrefixes(Map<String, String> map) Copies the prefix mapping from other into this.Copies the prefixes from other into this.Compress the URI using the prefix mappings if possible.longsize()size will return the number of statements in a concrete model, for a virtualized model such as one created by an inference engine, it will return an estimated lower bound for the number of statements in the model but it is possible for a subsequent listStatements on such a model to discover more statements than size() indicated.booleanDetermine whether this model supports set operations.booleanDetermine whether this model supports transactions.toString()Create a new, independent, model containing all the statements in this model together with all of those in another given model.unregister(ModelChangedListener listener) Unregister the listener from this model by unregistering its GraphListener adaption from the underlying Graph.withDefaultMappings(PrefixMapping other) Update this PrefixMapping with the bindings inmap, only adding those (p, u) pairs for which neither p nor u appears in this mapping.write(OutputStream writer) Write a serialization of this model as an XML document.write(OutputStream writer, String lang) Write a serialized representation of this model in a specified language.write(OutputStream writer, String lang, String base) Write a serialized representation of a model in a specified language.Write the model as an XML document.Write a serialized representation of a model in a specified language.Write a serialized representation of a model in a specified language.Methods inherited from class org.apache.jena.enhanced.EnhGraph
asGraph, equals, getNodeAs, hashCode, isIsomorphicWithMethods inherited from interface org.apache.jena.rdf.model.Model
createReifier, createReifier, createResource, equals
-
Constructor Details
-
ModelCom
make a model based on the specified graph -
ModelCom
-
-
Method Details
-
getGraph
Description copied from interface:ModelGraphInterfaceAnswer the Graph which this Model is presenting.- Specified by:
getGraphin interfaceModelGraphInterface
-
asRDFNode
Description copied from interface:ModelGraphInterfaceAnswer an RDF node wrappingnsuitably; URI nodes become Resources with the same URI, blank nodes become Resources with URI null but the same AnonId, and literal nodes become Literals withnas their value carrier.- Specified by:
asRDFNodein interfaceModelGraphInterface
-
wrapAsResource
- Specified by:
wrapAsResourcein interfaceModelGraphInterface
-
addLiteral
Description copied from interface:ModelConAdd the statement (s, p, createTypedLiteral( o )) to this model and answer this model.- Specified by:
addLiteralin interfaceModelCon
-
addLiteral
Description copied from interface:ModelConAdd the statement (s, p, createTypedLiteral( o )) to this model and answer this model.- Specified by:
addLiteralin interfaceModelCon
-
addLiteral
Description copied from interface:ModelConAdd the statement (s, p, createTypedLiteral( o )) to this model and answer this model.- Specified by:
addLiteralin interfaceModelCon
-
addLiteral
Description copied from interface:ModelConAdd the statement (s, p, createTypedLiteral( o )) to this model and answer this model.- Specified by:
addLiteralin interfaceModelCon
-
addLiteral
Description copied from interface:ModelConAdd the statement (s, p, o') to the model, where o' is the typed literal corresponding to o. Answer this model.- Specified by:
addLiteralin interfaceModelCon
-
addLiteral
Description copied from interface:ModelConAdd the statement (s, p, o') to the model, where o' is the typed literal corresponding to o. Answer this model.- Specified by:
addLiteralin interfaceModelCon
-
add
Description copied from interface:ModelConadd a statement to this model. -
add
Description copied from interface:ModelConadd a statement to this model. -
add
Description copied from interface:ModelConadd a statement to this model. -
add
Description copied from interface:ModelConadd a statement to this model. -
addLiteral
Description copied from interface:ModelConadd a statement to this model.- Specified by:
addLiteralin interfaceModelCon- Parameters:
s- the subject of the statement to addp- the predicate of the statement to addo- the object of the statement to add- Returns:
- this model
-
add
Description copied from interface:ModelAdd all the statements returned by an iterator to this model. -
add
Description copied from interface:ModelAdd all the statements in another model to this model. -
getReader
Description copied from interface:RDFReaderFreturn an RDFReader instance for the specified serialization language.- Specified by:
getReaderin interfaceModel- Specified by:
getReaderin interfaceRDFReaderF- Parameters:
lang- the serialization language -nullselects the default (RDF/XML).- Returns:
- the RDFWriter instance
-
read
Description copied from interface:ModelAdd the RDF statements from a document. Uses content negotiation to request appropriate mime types. If the content type is not found, it may guess from the URL.See
Modelfor a description of how to traverse a firewall.See "Reading and Writing RDF in Apache Jena" for more information about determining the syntax.
-
read
Description copied from interface:ModelUsing this method is often a mistake. Add statements from an RDF/XML serialization. It is generally better to use an InputStream if possible, otherwise there is a danger of a mismatch between the character encoding of say the FileReader and the character encoding of the data in the file. It is better to explicitly set the serialization format. SeeModel.read(InputStream, String, String)for explicitily setting the serialization language.See "Reading and Writing RDF in Apache Jena" for more information about concrete syntaxes.
-
read
Description copied from interface:ModelAdd statements from a document. This method assumes the concrete syntax is RDF/XML. SeeModel.read(InputStream, String, String)for explicitly setting the language.See "Reading and Writing RDF in Apache Jena" for more information about concrete syntaxes.
- Specified by:
readin interfaceModel- Parameters:
reader- the input streambase- the base uri to be used when converting relative URI's to absolute URI's. (Resolving relative URIs and fragment IDs is done by prepending the base URI to the relative URI/fragment.) If there are no relative URIs in the source, this argument may safely benull. If the base is the empty string, then relative URIs will be retained in the model. This is typically unwise and will usually generate errors when writing the model back out.- Returns:
- the current model
-
read
Description copied from interface:ModelAdd statements from a serializion in languagelangto the model.
Predefined values forlangare "RDF/XML", "N-TRIPLE", "TURTLE" (or "TTL") and "N3".nullrepresents the default language, "RDF/XML". "RDF/XML-ABBREV" is a synonym for "RDF/XML".
See
Modelfor a description of how to traverse a firewall.See "Reading and Writing RDF in Apache Jena" for more information about concrete syntaxes.
-
read
Description copied from interface:ModelRead into this model the RDF aturl, usingbaseURIas the base URI if it is non-null. The RDF is assumed to be RDF/XML unlesslangis non-null, in which case it names the language to be used. Answer this model. -
read
Description copied from interface:ModelUsing this method is often a mistake. Add RDF statements represented in languagelangto the model.
Predefined values forlangare "RDF/XML", "N-TRIPLE", "TURTLE" (or "TTL") and "N3".nullrepresents the default language, "RDF/XML". "RDF/XML-ABBREV" is a synonym for "RDF/XML".
It is generally better to use an InputStream if possible.Model.read(InputStream,String), otherwise there is a danger of a mismatch between the character encoding of say the FileReader and the character encoding of the data in the file.- Specified by:
readin interfaceModel- Parameters:
reader- the source of the input serializationbase- the base uri to be used when converting relative URI's to absolute URI's. (Resolving relative URIs and fragment IDs is done by prepending the base URI to the relative URI/fragment.) If there are no relative URIs in the source, this argument may safely benull. If the base is the empty string, then relative URIs will be retained in the model. This is typically unwise and will usually generate errors when writing the model back out.lang- the language of the serializationnullselects the default- Returns:
- this model
-
read
Description copied from interface:ModelAdd RDF statements represented in languagelangto the model.
Predefined values forlangare "RDF/XML", "N-TRIPLE", "TURTLE" (or "TTL").nullrepresents the default language, "RDF/XML". "RDF/XML-ABBREV" is a synonym for "RDF/XML".- Specified by:
readin interfaceModel- Parameters:
reader- the source of the input serializationbase- the base uri to be used when converting relative URI's to absolute URI's. (Resolving relative URIs and fragment IDs is done by prepending the base URI to the relative URI/fragment.) If there are no relative URIs in the source, this argument may safely benull. If the base is the empty string, then relative URIs will be retained in the model. This is typically unwise and will usually generate errors when writing the model back out.See "Reading and Writing RDF in Apache Jena" for more information about concrete syntaxes.
lang- the language of the serializationnullselects the default- Returns:
- this model
-
getWriter
Get the model's writer after priming it with the model's namespace prefixes.- Specified by:
getWriterin interfaceModel- Specified by:
getWriterin interfaceRDFWriterF- Parameters:
lang- the serialization language -nullselects the default (RDF/XML)- Returns:
- the RDFWriter instance
-
write
Description copied from interface:ModelWrite the model as an XML document. It is often better to use an OutputStream rather than a Writer, since this will avoid character encoding errors.
-
write
Description copied from interface:ModelWrite a serialized representation of a model in a specified language. It is often better to use an OutputStream rather than a Writer, since this will avoid character encoding errors.
The language in which to write the model is specified by the
langargument. Predefined values are "RDF/XML", "RDF/XML-ABBREV", "N-TRIPLE", "TURTLE", (and "TTL") and "N3". The default value, represented bynullis "RDF/XML". -
write
Description copied from interface:ModelWrite a serialized representation of a model in a specified language. It is often better to use an OutputStream rather than a Writer, since this will avoid character encoding errors.
The language in which to write the model is specified by the
langargument. Predefined values are "RDF/XML", "RDF/XML-ABBREV", "N-TRIPLE", "TURTLE", (and "TTL") and "N3". The default value, represented bynull, is "RDF/XML". -
write
Description copied from interface:ModelWrite a serialization of this model as an XML document.
The language in which to write the model is specified by the
langargument. Predefined values are "RDF/XML", "RDF/XML-ABBREV", "N-TRIPLE" and "N3". The default value is represented bynullis "RDF/XML". -
write
Description copied from interface:ModelWrite a serialized representation of this model in a specified language.
The language in which to write the model is specified by the
langargument. Predefined values are "RDF/XML", "RDF/XML-ABBREV", "N-TRIPLE", "TURTLE", (and "TTL") and "N3". The default value, represented bynull, is "RDF/XML". -
write
Description copied from interface:ModelWrite a serialized representation of a model in a specified language.
The language in which to write the model is specified by the
langargument. Predefined values are "RDF/XML", "RDF/XML-ABBREV", "N-TRIPLE", "TURTLE", (and "TTL") and "N3". The default value, represented bynull, is "RDF/XML".- Specified by:
writein interfaceModel- Parameters:
writer- The output stream to which the RDF is writtenlang- The language in which the RDF should be writtenbase- The base uri to use when writing relative URI's.nullmeans use only absolute URI's. This is used for relative URIs that would be resolved against the document retrieval URL. For some values oflang, this value may be included in the output.- Returns:
- This model
-
remove
Description copied from interface:ModelRemoves a statement.The statement with the same subject, predicate and object as that supplied will be removed from the model.
-
remove
Description copied from interface:ModelConremove the statement(s, p, o)from this model and answer this model. None ofs, p, oare permitted to benull: for wildcard removal, seeremoveAll. -
remove
Description copied from interface:ModelConRemove all the Statements returned by an iterator. -
remove
Description copied from interface:ModelConRemove all the Statements in a given model, including reified statements -
removeAll
Description copied from interface:ModelRemove all the statements from this model. -
removeAll
Description copied from interface:ModelRemove all the statements matching (s, p, o) from this model. -
containsLiteral
Description copied from interface:ModelConAnswer true iff this model contains the statement (s, p, o') where o' is the typed literal corresponding to the value o.- Specified by:
containsLiteralin interfaceModelCon
-
containsLiteral
Description copied from interface:ModelConAnswer true iff this model contains the statement (s, p, o') where o' is the typed literal corresponding to the value o.- Specified by:
containsLiteralin interfaceModelCon
-
containsLiteral
Description copied from interface:ModelConAnswer true iff this model contains the statement (s, p, o') where o' is the typed literal corresponding to the value o.- Specified by:
containsLiteralin interfaceModelCon
-
containsLiteral
Description copied from interface:ModelConAnswer true iff this model contains the statement (s, p, o') where o' is the typed literal corresponding to the value o.- Specified by:
containsLiteralin interfaceModelCon
-
containsLiteral
Description copied from interface:ModelConAnswer true iff this model contains (s, p, o') where o' is the typed literal corresponding to o.- Specified by:
containsLiteralin interfaceModelCon
-
containsLiteral
Description copied from interface:ModelConAnswer true iff this model contains the statement (s, p, o') where o' is the typed literal corresponding to the value o.- Specified by:
containsLiteralin interfaceModelCon
-
contains
Description copied from interface:ModelConDetermine if a statement is present in this model. -
contains
Description copied from interface:ModelConDetermine if a statement is present in this model.- Specified by:
containsin interfaceModelCon- Parameters:
s- The subject of the statement tested.p- The predicate of the statement tested.o- The string object in the statement tested.l- the language associated with the object.- Returns:
- true if the statement with subject s, property p and object o is in the model, false otherwise
-
contains
Description copied from interface:ModelConDetermine if a statement is present in this model.- Specified by:
containsin interfaceModelCon- Parameters:
s- The subject of the statement tested.p- The predicate of the statement tested.o- The string object in the statement tested.l- the language associated with the object.d- the language associated with the object.- Returns:
- true if the statement with subject s, property p and object o is in the model, false otherwise
-
containsLiteral
Description copied from interface:ModelConAnswer true iff this model contains the statement (s, p, o') where o' is the typed literal corresponding to the value o.- Specified by:
containsLiteralin interfaceModelCon
-
containsAny
Description copied from interface:ModelDetermine if any of the statements in a model are also contained in this model.- Specified by:
containsAnyin interfaceModel- Parameters:
model- the model containing the statements to be tested- Returns:
- true if any of the statements in model are also contained in this model and false otherwise.
-
containsAll
Description copied from interface:ModelDetermine if all of the statements in a model are also contained in this model.- Specified by:
containsAllin interfaceModel- Parameters:
model- the model containing the statements to be tested- Returns:
- true if all of the statements in model are also contained in this model and false otherwise.
-
containsAny
Description copied from interface:ModelDetermine if any of the statements returned by an iterator are contained in this model.- Specified by:
containsAnyin interfaceModel- Parameters:
iter- an iterator of the statements to be tested- Returns:
- true if any of the statements returns by iter are contained in this model and false otherwise.
-
containsAll
Description copied from interface:ModelDetermine if all of the statements returned by an iterator are contained in this model.- Specified by:
containsAllin interfaceModel- Parameters:
iter- an iterator of the statements to be tested- Returns:
- true if any of the statements returns by iter are contained in this model and false otherwise.
-
listStatements
Description copied from interface:ModelFind all the statements matching a pattern.Return an iterator over all the statements in a model that match a pattern. The statements selected are those whose subject matches the
subjectargument, whose predicate matches thepredicateargument and whose object matches theobjectargument. If an argument isnullit matches anything.- Specified by:
listStatementsin interfaceModel- Parameters:
S- The subject soughtP- The predicate soughtO- The value sought- Returns:
- an iterator over the subjects
-
listStatements
Description copied from interface:ModelConFind all the statements matching a pattern.Return an iterator over all the statements in a model that match a pattern. The statements selected are those whose subject matches the
subjectargument, whose predicate matches thepredicateargument and whose object matches theobjectargument.- Specified by:
listStatementsin interfaceModelCon- Parameters:
S- The subject soughtP- The predicate soughtO- The value sought- Returns:
- an iterator over the subjects
-
listStatements
Description copied from interface:ModelConFind all the statements matching a pattern.Return an iterator over all the statements in a model that match a pattern. The statements selected are those whose subject matches the
subjectargument, whose predicate matches thepredicateargument and whose object matches theobjectargument. If an argument isnullit matches anything.- Specified by:
listStatementsin interfaceModelCon- Parameters:
S- The subject soughtP- The predicate soughtO- The value soughtL- The lang code of the string.- Returns:
- an iterator over the subjects
-
listStatements
Description copied from interface:ModelConFind all the statements matching a pattern.Return an iterator over all the statements in a model that match a pattern. The statements selected are those whose subject matches the
subjectargument, whose predicate matches thepredicateargument and whose object matches theobjectargument. If an argument isnullit matches anything.- Specified by:
listStatementsin interfaceModelCon- Parameters:
S- The subject soughtP- The predicate soughtO- The value soughtL- The lang code of the string.D- The base direction of the string.- Returns:
- an iterator over the subjects
-
listLiteralStatements
Description copied from interface:ModelConAnswer a statement iterator that will iterate over all the statements (S, P, O) in this model where S matchessubject, P matchespredicate, and O matches the typed literal corresponding toobject.- Specified by:
listLiteralStatementsin interfaceModelCon
-
listLiteralStatements
Description copied from interface:ModelConAnswer a statement iterator that will iterate over all the statements (S, P, O) in this model where S matchessubject, P matchespredicate, and O matches the typed literal corresponding toobject.- Specified by:
listLiteralStatementsin interfaceModelCon
-
listLiteralStatements
Description copied from interface:ModelConAnswer a statement iterator that will iterate over all the statements (S, P, O) in this model where S matchessubject, P matchespredicate, and O matches the typed literal corresponding toobject.- Specified by:
listLiteralStatementsin interfaceModelCon
-
listLiteralStatements
Description copied from interface:ModelConAnswer a statement iterator that will iterate over all the statements (S, P, O) in this model where S matchessubject, P matchespredicate, and O matches the typed literal corresponding toobject.- Specified by:
listLiteralStatementsin interfaceModelCon
-
listLiteralStatements
Description copied from interface:ModelConAnswer a statement iterator that will iterate over all the statements (S, P, O) in this model where S matchessubject, P matchespredicate, and O matches the typed literal corresponding toobject.- Specified by:
listLiteralStatementsin interfaceModelCon
-
listLiteralStatements
Description copied from interface:ModelConAnswer a statement iterator that will iterate over all the statements (S, P, O) in this model where S matchessubject, P matchespredicate, and O matches the typed literal corresponding toobject.- Specified by:
listLiteralStatementsin interfaceModelCon
-
listResourcesWithProperty
Description copied from interface:ModelConAnswer an iterator [without duplicates] over all the resources in this model which have value o' for property p, where o' is the typed literal corresponding to o.- Specified by:
listResourcesWithPropertyin interfaceModelCon
-
listResourcesWithProperty
Description copied from interface:ModelConAnswer an iterator [without duplicates] over all the resources in this model which have value o' for property p, where o' is the typed literal corresponding to o.- Specified by:
listResourcesWithPropertyin interfaceModelCon
-
listResourcesWithProperty
Description copied from interface:ModelConAnswer an iterator [without duplicates] over all the resources in this model which have value o' for property p, where o' is the typed literal corresponding to o.- Specified by:
listResourcesWithPropertyin interfaceModelCon
-
listResourcesWithProperty
Description copied from interface:ModelConAnswer an iterator [without duplicates] over all the resources in this model which have value o' for property p, where o' is the typed literal corresponding to o.- Specified by:
listResourcesWithPropertyin interfaceModelCon
-
listResourcesWithProperty
Description copied from interface:ModelConAnswer an iterator [without duplicates] over all the resources in this model which have value o' for property p, where o' is the typed literal corresponding to o.- Specified by:
listResourcesWithPropertyin interfaceModelCon
-
listResourcesWithProperty
Description copied from interface:ModelConAnswer an iterator [without duplicates] over all the resources in this model which have value o' for property p, where o' is the typed literal corresponding to o.- Specified by:
listResourcesWithPropertyin interfaceModelCon
-
listSubjectsWithProperty
Description copied from interface:ModelAn alias forlistResourcesWithProperty, retained for backward compatibility. It may be deprecated in later releases.- Specified by:
listSubjectsWithPropertyin interfaceModel
-
listSubjectsWithProperty
Description copied from interface:ModelConlists all subjects with a given property and property value.- Specified by:
listSubjectsWithPropertyin interfaceModelCon- Parameters:
p- The predicate sought.o- The property value sought.- Returns:
- an iterator over the set of subjects
-
listSubjectsWithProperty
Description copied from interface:ModelConlists all subjects with a given property and property value.- Specified by:
listSubjectsWithPropertyin interfaceModelCon- Parameters:
p- The predicate sought.o- The property value sought.l- the language associated with the object- Returns:
- an iterator over the set of subjects
-
listSubjectsWithProperty
Description copied from interface:ModelConlists all subjects with a given property and property value.- Specified by:
listSubjectsWithPropertyin interfaceModelCon- Parameters:
p- The predicate sought.o- The property value sought.l- the language associated with the objectd- the text directio associated with the object- Returns:
- an iterator over the set of subjects
-
createResource
Description copied from interface:ModelConCreate a new anonymous resource with a given type.Subsequent operations on the returned resource may modify this model.
The resource is created and an rdf:type property added to the model to specify its type.
- Specified by:
createResourcein interfaceModelCon- Parameters:
type- the type of the resource to be created.- Returns:
- a new anonymous resource linked to this model.
-
createResource
Description copied from interface:ModelConCreate a new resource with a given type.Subsequent operations on the returned resource may modify this model.
The resource is created and an rdf:type property added to the model to specify its type.
- Specified by:
createResourcein interfaceModelCon- Parameters:
uri- The URI of the new resource.type- the type of the resource to be created.- Returns:
- a new resource linked to this model.
-
createStatementTerm
Description copied from interface:ModelCreate an RDFNode for a statement. This is in support of RDF 1.2 triple terms. Triple terms can only appear in the object position. Use with predicaterdf:reifies- Specified by:
createStatementTermin interfaceModel- Returns:
- a new resource linked to this model.
-
createTypedLiteral
create a type literal from a boolean value.The value is converted to a string using its
toStringmethod.- Specified by:
createTypedLiteralin interfaceModelCon- Parameters:
v- the value of the literal- Returns:
- a new literal representing the value v
-
createTypedLiteral
create a typed literal from an integer value.- Specified by:
createTypedLiteralin interfaceModelCon- Parameters:
v- the value of the literal- Returns:
- a new literal representing the value v
-
createTypedLiteral
create a typed literal from a long integer value.- Specified by:
createTypedLiteralin interfaceModelCon- Parameters:
v- the value of the literal- Returns:
- a new literal representing the value v
-
createTypedLiteral
create a typed literal from a char value.- Specified by:
createTypedLiteralin interfaceModelCon- Parameters:
v- the value of the literal- Returns:
- a new literal representing the value v
-
createTypedLiteral
create a typed literal from a float value.- Specified by:
createTypedLiteralin interfaceModelCon- Parameters:
v- the value of the literal- Returns:
- a new literal representing the value v
-
createTypedLiteral
create a typed literal from a double value.- Specified by:
createTypedLiteralin interfaceModelCon- Parameters:
v- the value of the literal- Returns:
- a new literal representing the value v
-
createTypedLiteral
create a typed literal from a String value.- Specified by:
createTypedLiteralin interfaceModelCon- Parameters:
v- the value of the literal- Returns:
- a new literal representing the value v
-
createTypedLiteral
Create a typed literal xsd:dateTime from a Calendar object.- Specified by:
createTypedLiteralin interfaceModelCon
-
createTypedLiteral
Build a typed literal from its lexical form. The lexical form will be parsed now and the value stored. If the form is not legal this will throw an exception.- Specified by:
createTypedLiteralin interfaceModel- Parameters:
lex- the lexical form of the literaldtype- the type of the literal, null for old style "plain" literals- Throws:
DatatypeFormatException- if lex is not a legal form of dtype
-
createTypedLiteral
Build a typed literal from its value form.- Specified by:
createTypedLiteralin interfaceModel- Parameters:
value- the value of the literaldtype- the type of the literal, null for old style "plain" literals
-
createTypedLiteral
Build a typed literal from its lexical form. The lexical form will be parsed now and the value stored. If the form is not legal this will throw an exception.- Specified by:
createTypedLiteralin interfaceModelCon- Parameters:
lex- the lexical form of the literaltypeURI- the uri of the type of the literal, null for old style "plain" literals- Throws:
DatatypeFormatException- if lex is not a legal form of dtype
-
createTypedLiteral
Build a typed literal from its value form.- Specified by:
createTypedLiteralin interfaceModelCon- Parameters:
value- the value of the literaltypeURI- the URI of the type of the literal, null for old style "plain" literals
-
createTypedLiteral
Build a typed literal label from its value form using whatever datatype is currently registered as the the default representation for this java class. No language tag is supplied.- Specified by:
createTypedLiteralin interfaceModel- Specified by:
createTypedLiteralin interfaceModelCon- Parameters:
value- the literal value to encapsulate- Returns:
- a new literal representing the value v
-
createLiteral
Description copied from interface:ModelConcreate a literal from a String value.- Specified by:
createLiteralin interfaceModelCon- Parameters:
v- the value of the literal- Returns:
- a new literal representing the value v
-
createLiteral
Description copied from interface:ModelCreate an untyped literal from a String value with a specified language.- Specified by:
createLiteralin interfaceModel- Parameters:
v- the lexical form of the literall- the language associated with the literal- Returns:
- a new literal representing the value v with the given language
-
createLiteral
Description copied from interface:ModelCreate an untyped literal from a String value with a specified language.- Specified by:
createLiteralin interfaceModel- Parameters:
v- the lexical form of the literall- the language associated with the literald- the base direction associated with the literal- Returns:
- a new literal representing the value v with the given language
-
createLiteralStatement
Description copied from interface:ModelConAnswer a new Statement object (s, p, o') where o' is the typed literal corresponding to o using createTypedLiteral.- Specified by:
createLiteralStatementin interfaceModelCon
-
createLiteralStatement
Description copied from interface:ModelConAnswer a new Statement object (s, p, o') where o' is the typed literal corresponding to o using createTypedLiteral.- Specified by:
createLiteralStatementin interfaceModelCon
-
createLiteralStatement
Description copied from interface:ModelConAnswer a new Statement object (s, p, o') where o' is the typed literal corresponding to o using createTypedLiteral.- Specified by:
createLiteralStatementin interfaceModelCon
-
createLiteralStatement
Description copied from interface:ModelConAnswer a new Statement object (s, p, o') where o' is the typed literal corresponding to o using createTypedLiteral.- Specified by:
createLiteralStatementin interfaceModelCon
-
createLiteralStatement
Description copied from interface:ModelConAnswer a new Statement object (s, p, o') where o' is the typed literal corresponding to o using createTypedLiteral.- Specified by:
createLiteralStatementin interfaceModelCon
-
createLiteralStatement
Description copied from interface:ModelConAnswer a new Statement object (s, p, o') where o' is the typed literal corresponding to o using createTypedLiteral.- Specified by:
createLiteralStatementin interfaceModelCon
-
createStatement
Description copied from interface:ModelConCreate a Statement instance.Subsequent operations on the statement or any of its parts may modify this model.
Creating a statement does not add it to the set of statements in the model.
The Object o will be converted to a Literal.
- Specified by:
createStatementin interfaceModelCon- Parameters:
r- the subject of the statementp- the predicate of the statemento- is the value to be the object of the statement- Returns:
- the new statement
-
createLiteralStatement
Description copied from interface:ModelConAnswer a new Statement object (s, p, o') where o' is the typed literal corresponding to o using createTypedLiteral.- Specified by:
createLiteralStatementin interfaceModelCon
-
createStatement
Description copied from interface:ModelConCreate a Statement instance.Subsequent operations on the statement or any of its parts may modify this model.
Creating a statement does not add it to the set of statements in the model.
The Object o will be converted to a Literal.
- Specified by:
createStatementin interfaceModelCon- Parameters:
r- the subject of the statementp- the predicate of the statemento- is the value to be the object of the statementl- the language associated with the object- Returns:
- the new statement
-
createBag
Description copied from interface:ModelConCreate a new anonymous bag.Subsequent operations on the bag or any of its parts may modify this model.
A statement defining the type of the new bag is added to this model.
-
createAlt
Description copied from interface:ModelConCreate a new anonymous alt.Subsequent operations on the alt or any of its parts may modify this model.
A statement defining the type of the new alt is added to this model.
-
createSeq
Description copied from interface:ModelConCreate a new anonymous seq.Subsequent operations on the seq or any of its parts may modify this model.
A statement defining the type of the new seq is added to this model.
-
createList
Answer a (the) new empty list Until this is made the object or subject in the model, it will not appear in a written form.- Specified by:
createListin interfaceModel- Returns:
- An RDF-encoded list of no elements (ie nil)
-
createList
Answer a new list containing the resources from the given iterator, in order.
- Specified by:
createListin interfaceModel- Parameters:
members- An iterator, each value of which is expected to be an RDFNode.- Returns:
- An RDF-encoded list of the elements of the iterator
-
createList
Answer a new list containing the RDF nodes from the given array, in order
- Specified by:
createListin interfaceModel- Parameters:
members- An array of RDFNodes that will be the members of the list- Returns:
- An RDF-encoded list
-
getRDFNode
Description copied from interface:ModelConCreate or find an RDFNode (aResourceor aLiteral) from a graph Node. This is provided for users and developers operating at the API/SPI interface, where Resources are constructed from Nodes. Providing this method allows each Model the opportunity to cache node-to-resource maps if it requires.- Specified by:
getRDFNodein interfaceModelCon- Parameters:
n- the graph.Node on which to base the Model.RDFNode- Returns:
- a suitable RDFNode
-
getResource
Description copied from interface:ModelReturn a Resource instance with the given URI in this model. This method behaves identically to.Model.createResource(String)Subsequent operations on the returned object may modify this model.
- Specified by:
getResourcein interfaceModel- Parameters:
uri- the URI of the resource- Returns:
- a resource instance
-
getResource
Description copied from interface:ModelReturn a Resource instance with the given URI in this model. This method behaves identically to.Model.createResource(AnonId)Subsequent operations on the returned object may modify this model.
- Specified by:
getResourcein interfaceModel- Parameters:
id- An anonymous bode Id.- Returns:
- a resource instance
-
getProperty
Description copied from interface:ModelConReturn a Property instance in this model.Subsequent operations on the returned property may modify this model.
The property is assumed to already exist in the model. If it does not,
createPropertyshould be used instead.- Specified by:
getPropertyin interfaceModelCon- Parameters:
uri- the URI of the property- Returns:
- a property object
-
getProperty
Description copied from interface:ModelReturn a Property instance with the given URI in this model. This method behaves identically tocreateProperty(String,String)and exists as legacy: createProperty is now capable of, and allowed to, reuse existing objects.Subsequent operations on the returned property may modify this model.
- Specified by:
getPropertyin interfaceModel- Parameters:
nameSpace- the RDF namespace of the propertylocalName- the localName of the property in its namespace- Returns:
- a property linked to this model
-
getSeq
Description copied from interface:ModelConReturn a Seq instance in this model.Subsequent operations on the returned sequence may modify this model.
The seq is assumed to already exist in the model. If it does not,
createSeqshould be used instead. -
getSeq
Description copied from interface:ModelConReturn a Seq instance based on a given resource.This method enables an application to treat any resource as a Seq. It is in effect an unsafe downcast.
Subsequent operations on the returned Seq may modify this model.
The Seq is assumed to already exist in the model. If it does not,
createSeqshould be used instead. -
getBag
Description copied from interface:ModelConReturn a Bag instance in this model.Subsequent operations on the returned bag may modify this model.
The bag is assumed to already exist in the model. If it does not,
createBagshould be used instead. -
getBag
Description copied from interface:ModelConReturn a bag instance based on a given resource.This method enables an application to treat any resource as a bag. It is in effect an unsafe downcast.
Subsequent operations on the returned bag may modify this model.
The bag is assumed to already exist in the model. If it does not,
createBagshould be used instead. -
getList
Description copied from interface:ModelConReturn a RDF List instance in this model.Subsequent operations on the returned list may modify this model.
The list is assumed to already exist in the model. If it does not,
createListshould be used instead. -
getList
Description copied from interface:ModelConReturn a RDF List based on a given resource.This method enables an application to treat any resource as a list. It is in effect an unsafe downcast.
Subsequent operations on the returned list may modify this model.
The list is assumed to already exist in the model. If it does not,
createListshould be used instead. -
getAlt
Description copied from interface:ModelConReturn an Alt instance in this model.Subsequent operations on the returned object may modify this model.
The alt is assumed to already exist in the model. If it does not,
createAltshould be used instead. -
getAlt
Description copied from interface:ModelConReturn an Alt instance based on a given resource.This method enables an application to treat any resource as an Alt. It is in effect an unsafe downcast.
Subsequent operations on the returned Alt may modify this model.
The Alt is assumed to already exist in the model. If it does not,
createAltshould be used instead. -
size
public long size()Description copied from interface:Modelsize will return the number of statements in a concrete model, for a virtualized model such as one created by an inference engine, it will return an estimated lower bound for the number of statements in the model but it is possible for a subsequent listStatements on such a model to discover more statements than size() indicated. -
isEmpty
public boolean isEmpty()Description copied from interface:ModelAnswer true iff the model contains no explicit statements (ie it's size is zero, listStatements() would deliver the empty iterator). -
listNameSpaces
Description copied from interface:Model(You probably don't want this method; more likely you want the PrefixMapping methods that Model supports.) List the namespaces used by predicates and types in the model. This method is really intended for use by the RDF/XML writer, which needs to know these namespaces to generate correct and vaguely pretty XML.The namespaces returned are those of (a) every URI used as a property in the model and (b) those of every URI that appears as the object of an rdf:type statement.
Note that the notion of "namespace" used here is not that of an XML prefix-namespace, but just of the minimal legal left part of a URI (see Util.splitNamespace for details). If you want the RDF/XML (or N3) namespaces, treat the Model as a PrefixMapping.
- Specified by:
listNameSpacesin interfaceModel- Returns:
- an iterator over every predicate and type namespace
- See Also:
-
lock
Description copied from interface:PrefixMappingLock the PrefixMapping so that changes can no longer be made to it. Primarily intended to lock Standard against mutation.- Specified by:
lockin interfacePrefixMapping- Returns:
- this mapping, locked against changes
-
setNsPrefix
Description copied from interface:PrefixMappingSpecify the prefix name for a URI prefix string. Any existing use of that prefix name is overwritten. The result is this same prefixMapping. (The earlier restriction that adding second prefix for the same URI caused the earlier binding to be deleted has been withdrawn.)A prefix name must be a valid NCName, or the empty string. The empty string is reserved to mean "the default namespace".
Need not check the RFC2396 validity of the URI. Bad URIs are either silently ignored or behave as if they were good. The earlier restriction that the URI should end with a non-NCName character has been removed.
Note, in particular, that the prefix mapping can only be used if it includes the URI up to any '#' character because '#' is not legal in the local part of an NCName.
- Specified by:
setNsPrefixin interfaceModel- Specified by:
setNsPrefixin interfacePrefixMapping- Parameters:
prefix- the string to be used for the prefix.uri- the URI prefix to be named- Returns:
- this PrefixMapping
-
removeNsPrefix
Description copied from interface:PrefixMappingRemove any existing maplet with the given prefix name and answer this mapping. If the prefix is the empty string, then this removes the default namespace. If the prefix is not a legal prefix string, or is not present in the mapping, nothing happens.The reverse URI-to-prefix mapping is updated, but if there are multiple prefixes for the removed URI it is unspecified which of them will be chosen.
- Specified by:
removeNsPrefixin interfaceModel- Specified by:
removeNsPrefixin interfacePrefixMapping- Parameters:
prefix- the prefix string to remove- Returns:
- this PrefixMapping
-
clearNsPrefixMap
Description copied from interface:PrefixMappingClear this prefix mapping of all mappings- Specified by:
clearNsPrefixMapin interfaceModel- Specified by:
clearNsPrefixMapin interfacePrefixMapping
-
setNsPrefixes
Description copied from interface:PrefixMappingCopies the prefix mapping from other into this. Illegal prefix mappings are detected. Existing binds of the same prefix are lost. The result is this same prefixMapping.- Specified by:
setNsPrefixesin interfaceModel- Specified by:
setNsPrefixesin interfacePrefixMapping- Parameters:
map- the Map whose maplets are to be added- Returns:
- this PrefixMapping
-
getNsPrefixURI
Description copied from interface:PrefixMappingGet the URI bound to a specific prefix, null if there isn't one.- Specified by:
getNsPrefixURIin interfacePrefixMapping- Parameters:
prefix- the prefix name to be looked up- Returns:
- the most recent URI bound to that prefix name, null if none
-
getNsURIPrefix
Description copied from interface:PrefixMappingAnswer the prefix for the given URI, or null if there isn't one. If there is more than one, one of them will be picked. If possible, it will be the most recently added prefix. (The cases where it's not possible is when a binding has been removed.)- Specified by:
getNsURIPrefixin interfacePrefixMapping- Parameters:
uri- the uri whose prefix is to be found- Returns:
- the prefix mapped to that uri, or null if there isn't one
-
getNsPrefixMap
Description copied from interface:PrefixMappingReturn a copy of the internal mapping from names to URI strings. Updating this copy will have no effect on the PrefixMap.- Specified by:
getNsPrefixMapin interfacePrefixMapping- Returns:
- a copy of the internal String -> String mapping
-
expandPrefix
Description copied from interface:PrefixMappingExpand the uri using the prefix mappings if possible. If prefixed has the form Foo:Bar, and Foo is a prefix bound to FooURI, return FooURI+Bar. Otherwise return prefixed unchanged.- Specified by:
expandPrefixin interfacePrefixMapping- Parameters:
prefixed- a QName or URI- Returns:
- the expanded string if possible, otherwise the original string
-
qnameFor
Description copied from interface:PrefixMappingAnswer a qname with the expansion of the given uri, or null if no such qname can be constructed using the mapping's prefixes.- Specified by:
qnameForin interfacePrefixMapping
-
shortForm
Description copied from interface:PrefixMappingCompress the URI using the prefix mappings if possible. If there is a prefix mapping Name -> URIStart, and uri is URIStart+Tail, return Name:Tail; otherwise return uri unchanged. If there are multiple applicable mappings available, the "most recent" is chosen if that is possible, otherwise one is picked "at random".The result is primarily intended for human convenience: it is not necessarily a legal QName, as Tail need not be a legal NCName; and there's no way to tell a shortened name from a URI with an unusual scheme.
- Specified by:
shortFormin interfacePrefixMapping- Parameters:
uri- the URI string to try and prefix-compress- Returns:
- the shortened form if possible, otherwise the unchanged argument
-
hasNoMappings
public boolean hasNoMappings()Description copied from interface:PrefixMappingReturn whether the prefix mapping has any defined prefixes.- Specified by:
hasNoMappingsin interfacePrefixMapping
-
numPrefixes
public int numPrefixes()Description copied from interface:PrefixMappingReturn the number of defined prefixes.- Specified by:
numPrefixesin interfacePrefixMapping
-
addNamespaces
Service method to update the namespaces of a Model given the mappings from prefix names to sets of URIs. If the prefix maps to multiple URIs, then we discard it completely.- Parameters:
m- Model whose namespace is to be updatedns- the namespace map to add to the Model
-
listStatements
Description copied from interface:ModelList all statements.Subsequent operations on those statements may modify this model.
- Specified by:
listStatementsin interfaceModel- Returns:
- an iterator over all statements in the model.
-
add
add a Statement to this Model by adding its SPO components. -
add
Add all the statements to the model by converting them to an array of corresponding triples and removing those from the underlying graph. -
add
Add all the statements to the model by converting the list to an array of Statement and removing that. -
remove
remove all the Statements from the model by converting them to triples and removing those triples from the underlying graph. -
remove
Remove all the Statements from the model by converting the List to a List(Statement) and removing that. -
add
Description copied from interface:ModelConadd a statement to this model. -
contains
Description copied from interface:ModelDetermine if a statement is present in this model. -
containsResource
Description copied from interface:Modeldetermine if the RDFNode r appears in any statement of this model. (containsRDFNode is a horrible name, and in any case, even literals will be resources one day)- Specified by:
containsResourcein interfaceModel- Parameters:
r- the RDFNode to be searched for- Returns:
- true iff r appears as some subject, predicate, or object
-
contains
Description copied from interface:ModelDetermine whether this model contains any statements with a given subject and property. -
contains
Description copied from interface:ModelDetermine if an (S, P, O) pattern is present in this model, with null allowed to represent a wildcard match.- Specified by:
containsin interfaceModel- Parameters:
s- The subject of the statement tested (null as wildcard).p- The predicate of the statement tested (null as wildcard).o- The object of the statement tested (null as wildcard).- Returns:
- true if the statement with subject s, property p and object o is in the model, false otherwise
-
getRequiredProperty
Description copied from interface:ModelReturn a statement with given subject and property.If more than one statement witht the given subject and property exists in the model, it is undefined which will be returned. If none exist, an exception is thrown.
- Specified by:
getRequiredPropertyin interfaceModel- Parameters:
s- The subject of the statement to be returned.p- The property of the statement to be returned.- Returns:
- A statement from the model with the given subject and property.
-
getRequiredProperty
Description copied from interface:ModelReturn a statement with given subject and property.If more than one statement witht the given subject and property exists in the model, it is undefined which will be returned. If none exist, an exception is thrown.
- Specified by:
getRequiredPropertyin interfaceModel- Parameters:
s- The subject of the statement to be returned.p- The property of the statement to be returned.lang- The language- Returns:
- A statement from the model with the given subject and property.
-
getProperty
Description copied from interface:ModelAnswer a statement (s, p, ?O) from this model. If none exist, return null; if several exist, pick one arbitrarily.- Specified by:
getPropertyin interfaceModel- Parameters:
s- the subject of the statement to returnp- the predicate of the statement to return- Returns:
- some statement (s, p, ?O) or null if none can be found
-
getProperty
Description copied from interface:ModelAnswer a statement (s, p, ?O) from this model. If none exist, return null; if several exist, pick one arbitrarily.- Specified by:
getPropertyin interfaceModel- Parameters:
s- the subject of the statement to returnp- the predicate of the statement to returnlang- language of the object- Returns:
- some statement (s, p, ?O@lang) or null if none can be found
-
asNode
-
listSubjects
Description copied from interface:ModelList all resources which are subjects of statements.Subsequent operations on those resource may modify this model.
- Specified by:
listSubjectsin interfaceModel- Returns:
- an iterator over a set of resources which are subjects of statements in the model. .remove() is not implemented on this iterator.
-
listResourcesWithProperty
Description copied from interface:ModelAnswer an iterator [with no duplicates] over all the resources in this model that have propertyp.remove()is not implemented on this iterator.- Specified by:
listResourcesWithPropertyin interfaceModel
-
listSubjectsWithProperty
Description copied from interface:ModelAn alias forlistResourcesWithProperty(Property), retained for backward compatibility. It may be deprecated in later releases.- Specified by:
listSubjectsWithPropertyin interfaceModel
-
listResourcesWithProperty
Description copied from interface:ModelAnswer an iterator [with no duplicates] over all the resources in this model that have propertypwith valueo.remove()is not implemented on this iterator.- Specified by:
listResourcesWithPropertyin interfaceModel
-
listObjects
Description copied from interface:ModelList all objects in a model.- Specified by:
listObjectsin interfaceModel- Returns:
- an iterator over the objects. .remove() is not implemented on this iterator.
-
listObjectsOfProperty
Description copied from interface:ModelList all objects of a given property. .remove() is not implemented on this iterator.- Specified by:
listObjectsOfPropertyin interfaceModel- Parameters:
p- The predicate sought- Returns:
- an iterator over the objects
-
listObjectsOfProperty
Description copied from interface:ModelList the values of a property of a resource.- Specified by:
listObjectsOfPropertyin interfaceModelp- The predicate sought- Returns:
- an iterator over the objects. .remove() is not implemented on this iterator.
-
supportsTransactions
public boolean supportsTransactions()Description copied from interface:ModelDetermine whether this model supports transactions.- Specified by:
supportsTransactionsin interfaceModel- Returns:
- true if this model supports transactions.
-
begin
Description copied from interface:ModelBegin a new transaction.All changes made to a model within a transaction, will either be made, or none of them will be made.
-
abort
Description copied from interface:ModelAbort the current transaction and abandon any changes in progress. -
commit
Description copied from interface:ModelCommit the current transaction. -
executeInTxn
Description copied from interface:ModelExecute the runnableactionwithin a transaction. If it completes normally, commit the transaction, otherwise abort the transaction.- Specified by:
executeInTxnin interfaceModel
-
calculateInTxn
Execute the supplieractionwithin a transaction. If it completes normally, commit the transaction and return the result, otherwise abort the transaction.- Specified by:
calculateInTxnin interfaceModel
-
independent
public boolean independent()Description copied from interface:ModelDetermine whether this model is 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.
- Specified by:
independentin interfaceModel- Returns:
- true if this model is indepdent of others
-
createResource
Description copied from interface:ModelCreate a new anonymous resource whose model is this model. This bnode will have a new AnonId distinct from any allocated by any other call of this method.Subsequent operations on the returned resource may modify this model.
- Specified by:
createResourcein interfaceModel- Returns:
- a new anonymous resource linked to this model.
-
createResource
Description copied from interface:ModelCreate a new resource associated with this model. If the uri string is null, this creates a bnode, as percreateResource(). Otherwise it creates a URI node. A URI resource is .equals() to any other URI Resource with the same URI (even in a different model - be warned).This method may return an existing Resource with the correct URI and model, or it may construct a fresh one, as it sees fit.
Operations on the result Resource may change this model.
- Specified by:
createResourcein interfaceModel- Parameters:
uri- the URI of the resource to be created- Returns:
- a new resource linked to this model.
-
createResource
Description copied from interface:ModelCreate a blank node resource with a specified identifier. The resulting bnode will be equal to any other bnode with the same AnonId (even if they are in separate models - be warned). The intended use for this method is to allow bnode round-tripping between Jena models and other representations.This method may return an existing bnode with the correct AnonId and model, or it may construct a fresh one, as it sees fit.
Operations on the result may modify this model
- Specified by:
createResourcein interfaceModel- Parameters:
anonId- the identifier to use for this blank node- Returns:
- a blank node with that identifier
-
createProperty
Description copied from interface:ModelConCreate a property.Subsequent operations on the returned property may modify this model.
- Specified by:
createPropertyin interfaceModelCon- Parameters:
uri- the URI of the property- Returns:
- a property instance
-
createProperty
Description copied from interface:ModelCreate a property with a given URI composed from a namespace part and a localname part by concatenating the strings.This method may return an existing property with the correct URI and model, or it may construct a fresh one, as it sees fit.
Subsequent operations on the returned property may modify this model.
- Specified by:
createPropertyin interfaceModel- Parameters:
nameSpace- the nameSpace of the propertylocalName- the name of the property within its namespace- Returns:
- a property instance
-
createStatement
create a Statement from the given r, p, and o.- Specified by:
createStatementin interfaceModel- Parameters:
r- the subject of the statementp- the predicate of the statemento- the object of the statement- Returns:
- the new statement
-
createBag
Description copied from interface:ModelConCreate a new bag.Subsequent operations on the bag or any of its parts may modify this model.
A statement defining the type of the new bag is added to this model.
-
createAlt
Description copied from interface:ModelConCreate a new alt.Subsequent operations on the alt or any of its parts may modify this model.
A statement defining the type of the new alt is added to this model.
-
createSeq
Description copied from interface:ModelConCreate a new seq.Subsequent operations on the seq or any of its parts may modify this model.
A statement defining the type of the new seq is added to this model.
-
asStatement
Answer a Statement in this Model which encodes the given Triple.- Specified by:
asStatementin interfaceModelGraphInterface- Parameters:
t- a triple to wrap as a statement- Returns:
- a statement wrapping the triple and in this model
-
asStatements
-
asStatements
-
asModel
-
asStatements
-
listBySubject
-
close
public void close()Description copied from interface:ModelClose the Model and free up resources held.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.
-
isClosed
public boolean isClosed()Description copied from interface:ModelAnswer true iff .close() has been called on this Model. -
supportsSetOperations
public boolean supportsSetOperations()Description copied from interface:ModelDetermine whether this model supports set operations.- Specified by:
supportsSetOperationsin interfaceModel- Returns:
- true if this model supports set operations.
-
union
Description copied from interface:ModelCreate a new, independent, model containing all the statements in this model together with all of those in another given model. By independent we mean that changes to the result model do not affect the operand models, and vice versa.The new model need not be of the same type as either this model or the argument model: typically it will be a memory-based model, even if this model is a database model.
-
intersection
Intersect this with another model. As an attempt at optimisation, we try and ensure we iterate over the smaller model first. Nowadays it's not clear that this is a good idea, sincesize()can be expensive on database and inference models.- Specified by:
intersectionin interfaceModel- Parameters:
other- The other model.- Returns:
- A new model containing all the statements that are in both models.
- See Also:
-
intersect
Answer a Model that is the intersection of the two argument models. The first argument is the model iterated over, and the second argument is the one used to check for membership. [So the first one should be "small" and the second one "membership cheap".] -
difference
Description copied from interface:ModelCreate a new, independent, model containing all the statements in this model which are not in another. The new model need not be of the same type as either this model or the argument model: typically it will be a memory-based model.- Specified by:
differencein interfaceModel- Parameters:
model- the other model whose statements are to be excluded.- Returns:
- a new model containing all the statements in this model that are not in the given model.
-
toString
-
reifiedToString
-
isIsomorphicWith
Answer whether or not these two graphs are isomorphic.- Specified by:
isIsomorphicWithin interfaceModel- Parameters:
m- Compare against this.- Returns:
- boolean True if the two RDF graphs are isomorphic.
-
getModelLock
-
getLock
Description copied from interface:ModelGet the model lock for this model.See also the operations
Lock.enterCriticalSection(boolean)andLock.leaveCriticalSection().It is better to use transactions.
-
enterCriticalSection
public void enterCriticalSection(boolean requestReadLock) Description copied from interface:LockEnter a critical section. The application must call leaveCriticialSection.- Specified by:
enterCriticalSectionin interfaceLock- Parameters:
requestReadLock- true implies a read lock, false implies write lock.- See Also:
-
leaveCriticalSection
public void leaveCriticalSection()Description copied from interface:LockLeave a critical section. Releases the lock form the matching enterCriticalSection- Specified by:
leaveCriticalSectionin interfaceLock- See Also:
-
register
Register the listener with this model by registering its GraphListener adaption with the underlying Graph. -
unregister
Unregister the listener from this model by unregistering its GraphListener adaption from the underlying Graph.- Specified by:
unregisterin interfaceModel- Parameters:
listener- A ModelChangedListener to unregister from model events- Returns:
- this model, for cascading
- See Also:
-
adapt
Answer a GraphListener that, when fed graph-level update events, fires the corresponding model-level event handlers inL.- Parameters:
L- a model listener to be wrapped as a graph listener- Returns:
- a graph listener wrapping L
- See Also:
-
notifyEvent
Description copied from interface:ModelNotify any listeners that the event e has occurred.- Specified by:
notifyEventin interfaceModel- Parameters:
e- the event that has occurred
-