Class ModelCom
- java.lang.Object
-
- org.apache.jena.enhanced.EnhGraph
-
- org.apache.jena.rdf.model.impl.ModelCom
-
- All Implemented Interfaces:
Model,ModelCon,ModelGraphInterface,RDFReaderF,RDFWriterF,Lock,PrefixMapping
- Direct Known Subclasses:
InfModelImpl,MonitorModel,OntModelImpl
public class ModelCom extends EnhGraph implements Model, PrefixMapping, Lock
Common methods for model implementations.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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Modelabort()Abort the current transaction and abandon any changes in progress.GraphListeneradapt(ModelChangedListener L)Answer a GraphListener that, when fed graph-level update events, fires the corresponding model-level event handlers inL.Modeladd(java.util.List<Statement> statements)Add all the statements to the model by converting the list to an array of Statement and removing that.Modeladd(Model m)Add all the statements in another model to this model, including the reified statements.Modeladd(Resource s, Property p, java.lang.String o)add a statement to this model.Modeladd(Resource s, Property p, java.lang.String o, boolean wellFormed)add a statement to this model.Modeladd(Resource s, Property p, java.lang.String o, java.lang.String l)add a statement to this model.Modeladd(Resource s, Property p, java.lang.String o, java.lang.String lang, boolean wellFormed)Modeladd(Resource s, Property p, java.lang.String lex, RDFDatatype datatype)add a statement to this model.Modeladd(Resource s, Property p, RDFNode o)add a statement to this model.Modeladd(Statement s)add a Statement to this Model by adding its SPO components.Modeladd(Statement[] statements)Add all the statements to the model by converting them to an array of corresponding triples and removing those from the underlying graph.Modeladd(StmtIterator iter)Add all the statements returned by an iterator to this model.ModeladdLiteral(Resource s, Property p, boolean o)Add the statement (s, p, createTypedLiteral( o )) to this model and answer this model.ModeladdLiteral(Resource s, Property p, char o)Add the statement (s, p, createTypedLiteral( o )) to this model and answer this model.ModeladdLiteral(Resource s, Property p, double o)Add the statement (s, p, o') to the model, where o' is the typed literal corresponding to o.ModeladdLiteral(Resource s, Property p, float o)Add the statement (s, p, o') to the model, where o' is the typed literal corresponding to o.ModeladdLiteral(Resource s, Property p, int o)Add the statement (s, p, createTypedLiteral( o )) to this model and answer this model.ModeladdLiteral(Resource s, Property p, long o)Add the statement (s, p, createTypedLiteral( o )) to this model and answer this model.ModeladdLiteral(Resource s, Property p, java.lang.Object o)Deprecated.ModeladdLiteral(Resource s, Property p, Literal o)add a statement to this model.static voidaddNamespaces(Model m, java.util.Map<java.lang.String,java.util.Set<java.lang.String>> ns)Service method to update the namespaces of a Model given the mappings from prefix names to sets of URIs.ModelasModel(Graph g)static NodeasNode(RDFNode x)RDFNodeasRDFNode(Node n)Answer 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.StatementasStatement(Triple t)Answer a Statement in this Model which encodes the given Triple.StmtIteratorasStatements(java.util.Iterator<Triple> it)java.util.List<Statement>asStatements(java.util.List<Triple> triples)Statement[]asStatements(Triple[] triples)Modelbegin()Begin a new transaction.<T> TcalculateInTxn(java.util.function.Supplier<T> action)Execute the supplieractionwithin a transaction.ModelclearNsPrefixMap()Clear this prefix mapping of all mappingsvoidclose()Close the Model and free up resources held.Modelcommit()Commit the current transaction.booleancontains(Resource s, Property p)Determine whether this model contains any statements with a given subject and property.booleancontains(Resource s, Property p, java.lang.String o)Determine if a statement is present in this model.booleancontains(Resource s, Property p, java.lang.String o, java.lang.String l)Determine if a statement is present in this model.booleancontains(Resource s, Property p, RDFNode o)Determine if an (S, P, O) pattern is present in this model, with null allowed to represent a wildcard match.booleancontains(Statement s)Determine 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, java.lang.Object o)Answer true iff this model contains the statement (s, p, o') where o' is the typed literal corresponding to the value o.booleancontainsResource(RDFNode r)determine if the RDFNode r appears in any statement of this model.AltcreateAlt()Create a new anonymous alt.AltcreateAlt(java.lang.String uri)Create a new alt.BagcreateBag()Create a new anonymous bag.BagcreateBag(java.lang.String uri)Create a new bag.RDFListcreateList()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.RDFListcreateList(java.util.Iterator<? extends RDFNode> members)Answer a new list containing the resources from the given iterator, in order.RDFListcreateList(RDFNode... members)Answer a new list containing the RDF nodes from the given array, in orderLiteralcreateLiteral(java.lang.String v)create a literal from a String value.LiteralcreateLiteral(java.lang.String v, boolean wellFormed)Create a literal from a String value.LiteralcreateLiteral(java.lang.String v, java.lang.String l)Create an untyped literal from a String value with a specified language.LiteralcreateLiteral(java.lang.String v, java.lang.String l, boolean wellFormed)StatementcreateLiteralStatement(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.StatementcreateLiteralStatement(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.StatementcreateLiteralStatement(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.StatementcreateLiteralStatement(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.StatementcreateLiteralStatement(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.StatementcreateLiteralStatement(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.StatementcreateLiteralStatement(Resource r, Property p, java.lang.Object o)Answer a new Statement object (s, p, o') where o' is the typed literal corresponding to o using createTypedLiteral.PropertycreateProperty(java.lang.String uri)Create a property.PropertycreateProperty(java.lang.String nameSpace, java.lang.String localName)Create a property with a given URI composed from a namespace part and a localname part by concatenating the strings.ReifiedStatementcreateReifiedStatement(java.lang.String uri, Statement s)answer a ReifiedStatement that encodes _s_, belongs to this Model, and is a Resource with that _uri_.ReifiedStatementcreateReifiedStatement(Statement s)create a ReifiedStatement that encodes _s_ and belongs to this Model.ResourcecreateResource()Create a new anonymous resource whose model is this model.ResourcecreateResource(java.lang.String uri)Create a new resource associated with this model.ResourcecreateResource(java.lang.String uri, Resource type)Create a new resource with a given type.ResourcecreateResource(java.lang.String uri, ResourceF f)Deprecated.ResourcecreateResource(AnonId id)Create a blank node resource with a specified identifier.ResourcecreateResource(Resource type)Create a new anonymous resource with a given type.ResourcecreateResource(ResourceF f)Deprecated.ResourcecreateResource(Statement statement)Create a resource that represents a statement.SeqcreateSeq()Create a new anonymous seq.SeqcreateSeq(java.lang.String uri)Create a new seq.StatementcreateStatement(Resource r, Property p, java.lang.String o)Create a Statement instance.StatementcreateStatement(Resource r, Property p, java.lang.String o, boolean wellFormed)Create a Statement instance.StatementcreateStatement(Resource r, Property p, java.lang.String o, java.lang.String l)Create a Statement instance.StatementcreateStatement(Resource r, Property p, java.lang.String o, java.lang.String l, boolean wellFormed)Create a Statement instance.StatementcreateStatement(Resource r, Property p, RDFNode o)create a Statement from the given r, p, and o.LiteralcreateTypedLiteral(boolean v)create a type literal from a boolean value.LiteralcreateTypedLiteral(char v)create a typed literal from a char value.LiteralcreateTypedLiteral(double v)create a typed literal from a double value.LiteralcreateTypedLiteral(float v)create a typed literal from a float value.LiteralcreateTypedLiteral(int v)create a typed literal from an integer value.LiteralcreateTypedLiteral(long v)create a typed literal from a long integer value.LiteralcreateTypedLiteral(java.lang.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.LiteralcreateTypedLiteral(java.lang.Object value, java.lang.String typeURI)Build a typed literal from its value form.LiteralcreateTypedLiteral(java.lang.Object value, RDFDatatype dtype)Build a typed literal from its value form.LiteralcreateTypedLiteral(java.lang.String v)create a typed literal from a String value.LiteralcreateTypedLiteral(java.lang.String lex, java.lang.String typeURI)Build a typed literal from its lexical form.LiteralcreateTypedLiteral(java.lang.String lex, RDFDatatype dtype)Build a typed literal from its lexical form.LiteralcreateTypedLiteral(java.util.Calendar cal)Create a typed literal xsd:dateTime from a Calendar object.Modeldifference(Model model)Create a new, independant, model containing all the statements in this model which are not in another.voidenterCriticalSection(boolean requestReadLock)Enter a critical section.voidexecuteInTxn(java.lang.Runnable action)Execute the runnableactionwithin a transaction.java.lang.StringexpandPrefix(java.lang.String prefixed)Expand the uri using the prefix mappings if possible.ExtendedIterator<Triple>findTriplesFrom(Selector s)Answer an [extended] iterator which returns the triples in this graph which are selected by the (S, P, O) triple in the selector, ignoring any special tests it may do.AltgetAlt(java.lang.String uri)Return an Alt instance in this model.AltgetAlt(Resource r)Return an Alt instance based on a given resource.ResourcegetAnyReifiedStatement(Statement s)get any reification of the given statement in this model; make one if necessary.BaggetBag(java.lang.String uri)Return a Bag instance in this model.BaggetBag(Resource r)Return a bag instance based on a given resource.GraphgetGraph()Answer the Graph which this Model is presenting.RDFListgetList(java.lang.String uri)Return a RDF List instance in this model.RDFListgetList(Resource r)Return a RDF List based on a given resource.LockgetLock()Get the model lock for this model.LockgetModelLock()java.util.Map<java.lang.String,java.lang.String>getNsPrefixMap()Return a copy of the internal mapping from names to URI strings.java.lang.StringgetNsPrefixURI(java.lang.String prefix)Get the URI bound to a specific prefix, null if there isn't one.java.lang.StringgetNsURIPrefix(java.lang.String uri)Answer the prefix for the given URI, or null if there isn't one.PropertygetProperty(java.lang.String uri)Return a Property instance in this model.PropertygetProperty(java.lang.String nameSpace, java.lang.String localName)Return a Property instance with the given URI in this model.StatementgetProperty(Resource s, Property p)Answer a statement (s, p, ?O) from this model.StatementgetProperty(Resource s, Property p, java.lang.String lang)Answer a statement (s, p, ?O) from this model.RDFNodegetRDFNode(Node n)RDFReaderIgetReader()return an RDFReader instance for the default serialization language.RDFReaderIgetReader(java.lang.String lang)return an RDFReader instance for the specified serialization language.StatementgetRequiredProperty(Resource s, Property p)Return a statement with given subject and property.StatementgetRequiredProperty(Resource s, Property p, java.lang.String lang)Return a statement with given subject and property.ResourcegetResource(java.lang.String uri)Return a Resource instance with the given URI in this model.ResourcegetResource(java.lang.String uri, ResourceF f)Deprecated.SeqgetSeq(java.lang.String uri)Return a Seq instance in this model.SeqgetSeq(Resource r)Return a Seq instance based on a given resource.RDFWriterIgetWriter()Get the model's writer after priming it with the model's namespace prefixes.RDFWriterIgetWriter(java.lang.String lang)Get the model's writer after priming it with the model's namespace prefixes.booleanhasNoMappings()Return whether the prefix mapping has any defined prefixes.booleanindependent()Determine whether this model is independent.static Modelintersect(Model smaller, Model larger)Answer a Model that is the intersection of the two argument models.Modelintersection(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).booleanisIsomorphicWith(Model m)Answer whether or not these two graphs are isomorphic.booleanisReified(Statement s)Determine if this Statement has been reified in this Model.voidleaveCriticalSection()Leave a critical section.StmtIteratorlistBySubject(Container cont)StmtIteratorlistLiteralStatements(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.StmtIteratorlistLiteralStatements(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.StmtIteratorlistLiteralStatements(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.StmtIteratorlistLiteralStatements(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.StmtIteratorlistLiteralStatements(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.StmtIteratorlistLiteralStatements(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.NsIteratorlistNameSpaces()(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.NodeIteratorlistObjects()List all objects in a model.NodeIteratorlistObjectsOfProperty(Property p)List all objects of a given property.NodeIteratorlistObjectsOfProperty(Resource s, Property p)List the values of a property of a resource.RSIteratorlistReifiedStatements()answer an iterator delivering all the reified statements "in" this modelRSIteratorlistReifiedStatements(Statement st)answer an iterator delivering all the reified statements "in" this model that match the statement _st_.ResIteratorlistResourcesWithProperty(Property p)Answer an iterator [with no duplicates] over all the resources in this model that have propertyp.ResIteratorlistResourcesWithProperty(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.ResIteratorlistResourcesWithProperty(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.ResIteratorlistResourcesWithProperty(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.ResIteratorlistResourcesWithProperty(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.ResIteratorlistResourcesWithProperty(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.ResIteratorlistResourcesWithProperty(Property p, java.lang.Object 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.ResIteratorlistResourcesWithProperty(Property p, RDFNode o)Answer an iterator [with no duplicates] over all the resources in this model that have propertypwith valueo.StmtIteratorlistStatements()List all statements.StmtIteratorlistStatements(Resource S, Property P, java.lang.String O)Find all the statements matching a pattern.StmtIteratorlistStatements(Resource S, Property P, java.lang.String O, java.lang.String L)Find all the statements matching a pattern.StmtIteratorlistStatements(Resource S, Property P, RDFNode O)Find all the statements matching a pattern.StmtIteratorlistStatements(Selector selector)List the statements matching a selector.ResIteratorlistSubjects()List all resources which are subjects of statements.ResIteratorlistSubjectsWithProperty(Property p)An alias forlistResourcesWithProperty(Property), retained for backward compatibility.ResIteratorlistSubjectsWithProperty(Property p, java.lang.String o)lists all subjects with a given property and property value.ResIteratorlistSubjectsWithProperty(Property p, java.lang.String o, java.lang.String l)lists all subjects with a given property and property value.ResIteratorlistSubjectsWithProperty(Property p, RDFNode o)An alias forlistResourcesWithProperty, retained for backward compatibility.PrefixMappinglock()Lock the PrefixMapping so that changes can no longer be made to it.ModelnotifyEvent(java.lang.Object e)Notify any listeners that the event e has occurred.intnumPrefixes()Return the number of defined prefixes.java.lang.StringqnameFor(java.lang.String uri)Answer a qname with the expansion of the given uri, or null if no such qname can be constructed using the mapping's prefixes.Modelquery(Selector selector)Create a new model containing the statements matching a query.Modelread(java.io.InputStream reader, java.lang.String base)Add statements from a document.Modelread(java.io.InputStream reader, java.lang.String base, java.lang.String lang)Add RDF statements represented in languagelangto the model.Modelread(java.io.Reader reader, java.lang.String base)Using this method is often a mistake.Modelread(java.io.Reader reader, java.lang.String base, java.lang.String lang)Using this method is often a mistake.Modelread(java.lang.String url)Add the RDF statements from a document.Modelread(java.lang.String url, java.lang.String lang)Add statements from a serializion in languagelangto the model.Modelread(java.lang.String url, java.lang.String base, java.lang.String lang)Read into this model the RDF aturl, usingbaseURIas the base URI if it is non-null.Modelregister(ModelChangedListener listener)Register the listener with this model by registering its GraphListener adaption with the underlying Graph.java.lang.StringreifiedToString()Modelremove(java.util.List<Statement> statements)Remove all the Statements from the model by converting the List to a List(Statement) and removing that.Modelremove(Model m)Remove all the Statements in a given model, including reified statementsModelremove(Resource s, Property p, RDFNode o)remove the statement(s, p, o)from this model and answer this model.Modelremove(Statement s)Removes a statement.Modelremove(Statement[] statements)remove all the Statements from the model by converting them to triples and removing those triples from the underlying graph.Modelremove(StmtIterator iter)Remove all the Statements returned by an iterator.ModelremoveAll()Remove all the statements from this model.ModelremoveAll(Resource s, Property p, RDFNode o)Remove all the statements matching (s, p, o) from this model.voidremoveAllReifications(Statement s)remove any ReifiedStatements reifying the given statementModelremoveNsPrefix(java.lang.String prefix)Remove any existing maplet with the given prefix name and answer this mapping.voidremoveReification(ReifiedStatement rs)Remove a particular reificiation.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.ModelsetNsPrefix(java.lang.String prefix, java.lang.String uri)Specify the prefix name for a URI prefix string.ModelsetNsPrefixes(java.util.Map<java.lang.String,java.lang.String> map)Copies the prefix mapping from other into this.ModelsetNsPrefixes(PrefixMapping pm)Copies the prefixes from other into this.java.lang.StringshortForm(java.lang.String uri)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 numberof statements in the model but it is possible for a subsequent listStatements on such a model to discover more statements than size() indicated.booleansupportsSetOperations()Determine whether this model supports set operations.booleansupportsTransactions()Determine whether this model supports transactions.java.lang.StringtoString()Modelunion(Model model)Create a new, independant, model containing all the statements in this model together with all of those in another given model.Modelunregister(ModelChangedListener listener)Unregister the listener from this model by unregistering its GraphListener adaption from the underlying Graph.ModelwithDefaultMappings(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.ResourcewrapAsResource(Node n)Modelwrite(java.io.OutputStream writer)Write a serialization of this model as an XML document.Modelwrite(java.io.OutputStream writer, java.lang.String lang)Write a serialized representation of this model in a specified language.Modelwrite(java.io.OutputStream writer, java.lang.String lang, java.lang.String base)Write a serialized representation of a model in a specified language.Modelwrite(java.io.Writer writer)Write the model as an XML document.Modelwrite(java.io.Writer writer, java.lang.String lang)Write a serialized representation of a model in a specified language.Modelwrite(java.io.Writer writer, java.lang.String lang, java.lang.String base)Write a serialized representation of a model in a specified language.-
Methods inherited from class org.apache.jena.enhanced.EnhGraph
asGraph, equals, getNodeAs, hashCode, isIsomorphicWith, setNodeCache
-
-
-
-
Constructor Detail
-
ModelCom
public ModelCom(Graph base)
make a model based on the specified graph
-
ModelCom
public ModelCom(Graph base, Personality<RDFNode> personality)
-
-
Method Detail
-
getGraph
public Graph getGraph()
Description copied from interface:ModelGraphInterfaceAnswer the Graph which this Model is presenting.- Specified by:
getGraphin interfaceModelGraphInterface
-
asRDFNode
public RDFNode asRDFNode(Node n)
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
public Resource wrapAsResource(Node n)
- Specified by:
wrapAsResourcein interfaceModelGraphInterface
-
getResource
@Deprecated public Resource getResource(java.lang.String uri, ResourceF f)
Deprecated.Description copied from interface:ModelConReturn a Resource instance in this model.Subsequent operations on the returned object may modify this model.
The resource is assumed to already exist in the model. If it does not,
createResourceshould be used instead.- Specified by:
getResourcein interfaceModelCon- Parameters:
uri- the URI of the resourcef- the factory object- Returns:
- a resource instance created by the factory provided
-
addLiteral
public Model addLiteral(Resource s, Property p, boolean o)
Description copied from interface:ModelConAdd the statement (s, p, createTypedLiteral( o )) to this model and answer this model.- Specified by:
addLiteralin interfaceModelCon
-
addLiteral
public Model addLiteral(Resource s, Property p, long o)
Description copied from interface:ModelConAdd the statement (s, p, createTypedLiteral( o )) to this model and answer this model.- Specified by:
addLiteralin interfaceModelCon
-
addLiteral
public Model addLiteral(Resource s, Property p, int o)
Description copied from interface:ModelConAdd the statement (s, p, createTypedLiteral( o )) to this model and answer this model.- Specified by:
addLiteralin interfaceModelCon
-
addLiteral
public Model addLiteral(Resource s, Property p, char o)
Description copied from interface:ModelConAdd the statement (s, p, createTypedLiteral( o )) to this model and answer this model.- Specified by:
addLiteralin interfaceModelCon
-
addLiteral
public Model addLiteral(Resource s, Property p, float o)
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
public Model addLiteral(Resource s, Property p, double o)
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
public Model add(Resource s, Property p, java.lang.String o)
Description copied from interface:ModelConadd a statement to this model.
-
add
public Model add(Resource s, Property p, java.lang.String o, boolean wellFormed)
Description copied from interface:ModelConadd a statement to this model.
-
add
public Model add(Resource s, Property p, java.lang.String o, java.lang.String lang, boolean wellFormed)
-
add
public Model add(Resource s, Property p, java.lang.String lex, RDFDatatype datatype)
Description copied from interface:ModelConadd a statement to this model.
-
add
public Model add(Resource s, Property p, java.lang.String o, java.lang.String l)
Description copied from interface:ModelConadd a statement to this model.
-
addLiteral
@Deprecated public Model addLiteral(Resource s, Property p, java.lang.Object o)
Deprecated.Description copied from interface:ModelConadd a statement to this model. Applications should use typed literals whereever possible.- 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
-
addLiteral
public Model addLiteral(Resource s, Property p, Literal o)
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
public Model add(StmtIterator iter)
Description copied from interface:ModelAdd all the statements returned by an iterator to this model.
-
add
public Model add(Model m)
Description copied from interface:ModelAdd all the statements in another model to this model, including the reified statements.
-
getReader
public RDFReaderI getReader()
Description copied from interface:RDFReaderFreturn an RDFReader instance for the default serialization language.- Specified by:
getReaderin interfaceRDFReaderF- Returns:
- an RDFReader instance for the default serialization language.
-
getReader
public RDFReaderI getReader(java.lang.String lang)
Description copied from interface:RDFReaderFreturn an RDFReader instance for the specified serialization language.- Specified by:
getReaderin interfaceRDFReaderF- Parameters:
lang- the serialization language -nullselects the default- Returns:
- the RDFWriter instance
-
read
public Model read(java.lang.String url)
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
public Model read(java.io.Reader reader, java.lang.String base)
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
public Model read(java.io.InputStream reader, java.lang.String base)
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
public Model read(java.lang.String url, java.lang.String lang)
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
public Model read(java.lang.String url, java.lang.String base, java.lang.String lang)
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
public Model read(java.io.Reader reader, java.lang.String base, java.lang.String lang)
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
public Model read(java.io.InputStream reader, java.lang.String base, java.lang.String lang)
Description copied from interface:ModelAdd 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".- 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
public RDFWriterI getWriter()
Get the model's writer after priming it with the model's namespace prefixes.- Specified by:
getWriterin interfaceRDFWriterF- Returns:
- an RDFWriter instance for the default serialization language.
-
getWriter
public RDFWriterI getWriter(java.lang.String lang)
Get the model's writer after priming it with the model's namespace prefixes.- Specified by:
getWriterin interfaceRDFWriterF- Parameters:
lang- the serialization language -nullselects the default- Returns:
- the RDFWriter instance
-
write
public Model write(java.io.Writer writer)
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
public Model write(java.io.Writer writer, java.lang.String lang)
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
public Model write(java.io.Writer writer, java.lang.String lang, java.lang.String base)
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
public Model write(java.io.OutputStream writer)
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
public Model write(java.io.OutputStream writer, java.lang.String lang)
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
public Model write(java.io.OutputStream writer, java.lang.String lang, java.lang.String base)
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
public Model remove(Statement s)
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
public Model remove(Resource s, Property p, RDFNode o)
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
public Model remove(StmtIterator iter)
Description copied from interface:ModelConRemove all the Statements returned by an iterator.
-
remove
public Model remove(Model m)
Description copied from interface:ModelConRemove all the Statements in a given model, including reified statements
-
removeAll
public Model removeAll()
Description copied from interface:ModelRemove all the statements from this model.
-
removeAll
public Model removeAll(Resource s, Property p, RDFNode o)
Description copied from interface:ModelRemove all the statements matching (s, p, o) from this model.
-
containsLiteral
public boolean containsLiteral(Resource s, Property p, boolean o)
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
public boolean containsLiteral(Resource s, Property p, long o)
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
public boolean containsLiteral(Resource s, Property p, int o)
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
public boolean containsLiteral(Resource s, Property p, char o)
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
public boolean containsLiteral(Resource s, Property p, float o)
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
public boolean containsLiteral(Resource s, Property p, double o)
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
public boolean contains(Resource s, Property p, java.lang.String o)
Description copied from interface:ModelConDetermine if a statement is present in this model.
-
contains
public boolean contains(Resource s, Property p, java.lang.String o, java.lang.String l)
Description copied from interface:ModelConDetermine if a statement is present in this model.- Specified by:
containsin interfaceModelCon- Parameters:
s- The subject of the statment tested.p- The predicate of the statement tested.o- The object of 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
-
containsLiteral
public boolean containsLiteral(Resource s, Property p, java.lang.Object o)
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
public boolean containsAny(Model model)
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
public boolean containsAll(Model model)
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
public boolean containsAny(StmtIterator iter)
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
public boolean containsAll(StmtIterator iter)
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
public StmtIterator listStatements(Resource S, Property P, RDFNode O)
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
public StmtIterator listStatements(Resource S, Property P, java.lang.String O)
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 matchestheobjectargument.- Specified by:
listStatementsin interfaceModelCon- Parameters:
S- The subject soughtP- The predicate soughtO- The value sought- Returns:
- an iterator over the subjects
-
listStatements
public StmtIterator listStatements(Resource S, Property P, java.lang.String O, java.lang.String L)
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 matchestheobjectargument. If an argument isnullit matches anything.- Specified by:
listStatementsin interfaceModelCon- Parameters:
S- The subject soughtP- The predicate soughtO- The value soughtL- The lang code ofthe string.- Returns:
- an iterator over the subjects
-
listLiteralStatements
public StmtIterator listLiteralStatements(Resource S, Property P, boolean O)
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
public StmtIterator listLiteralStatements(Resource S, Property P, long O)
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
public StmtIterator listLiteralStatements(Resource S, Property P, int O)
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
public StmtIterator listLiteralStatements(Resource S, Property P, char O)
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
public StmtIterator listLiteralStatements(Resource S, Property P, float O)
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
public StmtIterator listLiteralStatements(Resource S, Property P, double O)
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
public ResIterator listResourcesWithProperty(Property p, boolean o)
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
public ResIterator listResourcesWithProperty(Property p, char o)
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
public ResIterator listResourcesWithProperty(Property p, long o)
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
public ResIterator listResourcesWithProperty(Property p, float o)
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
public ResIterator listResourcesWithProperty(Property p, double o)
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
public ResIterator listResourcesWithProperty(Property p, java.lang.Object o)
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
public ResIterator listSubjectsWithProperty(Property p, RDFNode o)
Description copied from interface:ModelAn alias forlistResourcesWithProperty, retained for backward compatibility. It may be deprecated in later releases.- Specified by:
listSubjectsWithPropertyin interfaceModel
-
listSubjectsWithProperty
public ResIterator listSubjectsWithProperty(Property p, java.lang.String o)
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
public ResIterator listSubjectsWithProperty(Property p, java.lang.String o, java.lang.String l)
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
-
createResource
public Resource createResource(Resource type)
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
public Resource createResource(java.lang.String uri, Resource type)
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.
-
createResource
@Deprecated public Resource createResource(ResourceF f)
Deprecated.Description copied from interface:ModelConCreate a new anonymous resource using the supplied factory.Subsequent operations on the returned resource may modify this model.
- Specified by:
createResourcein interfaceModelCon- Parameters:
f- A factory object to create the returned object. .- Returns:
- a new anonymous resource linked to this model.
-
createResource
public Resource createResource(AnonId id)
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:
id- the identifier to use for this blank node- Returns:
- a blank node with that identifier
-
createResource
public Resource createResource(Statement statement)
Description copied from interface:ModelCreate a resource that represents a statement. This is in support of RDF-star.- Specified by:
createResourcein interfaceModel- Returns:
- a new resource linked to this model.
-
createResource
@Deprecated public Resource createResource(java.lang.String uri, ResourceF f)
Deprecated.Description copied from interface:ModelConCreate a new resource using the supplied factory.Subsequent operations on the returned resource may modify this model.
- Specified by:
createResourcein interfaceModelCon- Parameters:
uri- the URI of the resourcef- A factory to create the returned object. .- Returns:
- a new resource linked to this model.
-
createTypedLiteral
public Literal createTypedLiteral(boolean v)
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
public Literal createTypedLiteral(int v)
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
public Literal createTypedLiteral(long v)
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
public Literal createTypedLiteral(char v)
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
public Literal createTypedLiteral(float v)
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
public Literal createTypedLiteral(double v)
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
public Literal createTypedLiteral(java.lang.String v)
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
public Literal createTypedLiteral(java.util.Calendar cal)
Create a typed literal xsd:dateTime from a Calendar object.- Specified by:
createTypedLiteralin interfaceModelCon
-
createTypedLiteral
public Literal createTypedLiteral(java.lang.String lex, RDFDatatype dtype) throws DatatypeFormatException
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
public Literal createTypedLiteral(java.lang.Object value, RDFDatatype dtype)
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
public Literal createTypedLiteral(java.lang.String lex, java.lang.String typeURI)
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
public Literal createTypedLiteral(java.lang.Object value, java.lang.String typeURI)
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
public Literal createTypedLiteral(java.lang.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. 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
public Literal createLiteral(java.lang.String v)
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
public Literal createLiteral(java.lang.String v, java.lang.String l)
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
public Literal createLiteral(java.lang.String v, boolean wellFormed)
Description copied from interface:ModelCreate a literal from a String value. An existing literal of the right value may be returned, or a fresh one created. The use of the wellFormed flag is to create typed literals of type rdf:XMLLiteral, without error checking. This should only be use when the lexical form is known to already be in exclusive canonical XML.- Specified by:
createLiteralin interfaceModel- Parameters:
v- the lexical form of the literalwellFormed- true if the Literal is well formed XML, in the lexical space of rdf:XMLLiteral- Returns:
- a new literal
-
createLiteral
public Literal createLiteral(java.lang.String v, java.lang.String l, boolean wellFormed)
-
createLiteralStatement
public Statement createLiteralStatement(Resource r, Property p, boolean o)
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
public Statement createLiteralStatement(Resource r, Property p, long o)
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
public Statement createLiteralStatement(Resource r, Property p, int o)
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
public Statement createLiteralStatement(Resource r, Property p, char o)
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
public Statement createLiteralStatement(Resource r, Property p, float o)
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
public Statement createLiteralStatement(Resource r, Property p, double o)
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
public Statement createStatement(Resource r, Property p, java.lang.String o)
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
public Statement createLiteralStatement(Resource r, Property p, java.lang.Object o)
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
public Statement createStatement(Resource r, Property p, java.lang.String o, boolean wellFormed)
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 statementwellFormed- true if the string is well formed XML- Returns:
- the new statement
-
createStatement
public Statement createStatement(Resource r, Property p, java.lang.String o, java.lang.String l)
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
-
createStatement
public Statement createStatement(Resource r, Property p, java.lang.String o, java.lang.String l, boolean wellFormed)
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 objectwellFormed- true of the string is well formed XML- Returns:
- the new statement
-
createBag
public Bag 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
public Alt 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
public Seq 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
public RDFList 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
public RDFList createList(java.util.Iterator<? extends RDFNode> members)
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
public RDFList createList(RDFNode... members)
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
public RDFNode getRDFNode(Node n)
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
public Resource getResource(java.lang.String uri)
Description copied from interface:ModelReturn a Resource instance with the given URI in this model. This method behaves identically tocreateResource(String)and exists as legacy: createResource is now capable of, and allowed to, reuse existing objects.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
-
getProperty
public Property getProperty(java.lang.String uri)
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
public Property getProperty(java.lang.String nameSpace, java.lang.String localName)
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
public Seq getSeq(java.lang.String uri)
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
public Seq getSeq(Resource r)
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
public Bag getBag(java.lang.String uri)
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
public Bag getBag(Resource r)
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
public RDFList getList(java.lang.String uri)
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
public RDFList getList(Resource r)
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
public Alt getAlt(java.lang.String uri)
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
public Alt getAlt(Resource r)
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 numberof 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
public NsIterator 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:
PrefixMapping
-
samePrefixMappingAs
public boolean samePrefixMappingAs(PrefixMapping other)
Description copied from interface:PrefixMappingAnswer true iff this prefix-mappings are equal, that is, map the same prefixes to the same URIs; same asthis.getNsPrefixMap().equals( other.getNsPrefixMap() )
except that it may avoid unnecessary Map creations.- Specified by:
samePrefixMappingAsin interfacePrefixMapping
-
lock
public PrefixMapping 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
public Model setNsPrefix(java.lang.String prefix, java.lang.String uri)
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
public Model removeNsPrefix(java.lang.String prefix)
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
public Model clearNsPrefixMap()
Description copied from interface:PrefixMappingClear this prefix mapping of all mappings- Specified by:
clearNsPrefixMapin interfaceModel- Specified by:
clearNsPrefixMapin interfacePrefixMapping
-
setNsPrefixes
public Model setNsPrefixes(PrefixMapping pm)
Description copied from interface:PrefixMappingCopies the prefixes from other into this. Any existing binding of the same prefix is lost. The result is this same prefixMapping.- Specified by:
setNsPrefixesin interfaceModel- Specified by:
setNsPrefixesin interfacePrefixMapping- Parameters:
pm- the PrefixMapping to add- Returns:
- this PrefixMapping
-
setNsPrefixes
public Model setNsPrefixes(java.util.Map<java.lang.String,java.lang.String> map)
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
-
withDefaultMappings
public Model withDefaultMappings(PrefixMapping other)
Description copied from interface:PrefixMappingUpdate this PrefixMapping with the bindings inmap, only adding those (p, u) pairs for which neither p nor u appears in this mapping. Answer this PrefixMapping.- Specified by:
withDefaultMappingsin interfaceModel- Specified by:
withDefaultMappingsin interfacePrefixMapping
-
getNsPrefixURI
public java.lang.String getNsPrefixURI(java.lang.String prefix)
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
public java.lang.String getNsURIPrefix(java.lang.String uri)
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
public java.util.Map<java.lang.String,java.lang.String> 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
public java.lang.String expandPrefix(java.lang.String prefixed)
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
public java.lang.String qnameFor(java.lang.String uri)
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
public java.lang.String shortForm(java.lang.String uri)
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
public static void addNamespaces(Model m, java.util.Map<java.lang.String,java.util.Set<java.lang.String>> ns)
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 who's namespace is to be updatedns- the namespace map to add to the Model
-
listStatements
public StmtIterator 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
public Model add(Statement[] statements)
Add all the statements to the model by converting them to an array of corresponding triples and removing those from the underlying graph.
-
add
public Model add(java.util.List<Statement> statements)
Add all the statements to the model by converting the list to an array of Statement and removing that.
-
remove
public Model remove(Statement[] statements)
remove all the Statements from the model by converting them to triples and removing those triples from the underlying graph.
-
remove
public Model remove(java.util.List<Statement> statements)
Remove all the Statements from the model by converting the List to a List(Statement) and removing that.
-
add
public Model add(Resource s, Property p, RDFNode o)
Description copied from interface:ModelConadd a statement to this model.
-
listReifiedStatements
public RSIterator listReifiedStatements()
Description copied from interface:Modelanswer an iterator delivering all the reified statements "in" this model- Specified by:
listReifiedStatementsin interfaceModel- Returns:
- an iterator which delivers all the ReifiedStatements in this model
-
listReifiedStatements
public RSIterator listReifiedStatements(Statement st)
Description copied from interface:Modelanswer an iterator delivering all the reified statements "in" this model that match the statement _st_.- Specified by:
listReifiedStatementsin interfaceModel- Returns:
- an iterator each of whose elements is a ReifiedStatement in this model such that it's getStatement().equals( st )
-
isReified
public boolean isReified(Statement s)
Description copied from interface:ModelDetermine if this Statement has been reified in this Model.
-
getAnyReifiedStatement
public Resource getAnyReifiedStatement(Statement s)
get any reification of the given statement in this model; make one if necessary.- Specified by:
getAnyReifiedStatementin interfaceModel- Parameters:
s- for which a reification is sought- Returns:
- a ReifiedStatement that reifies _s_
-
removeAllReifications
public void removeAllReifications(Statement s)
remove any ReifiedStatements reifying the given statement- Specified by:
removeAllReificationsin interfaceModel- Parameters:
s- the statement who's reifications are to be discarded
-
removeReification
public void removeReification(ReifiedStatement rs)
Description copied from interface:ModelRemove a particular reificiation.- Specified by:
removeReificationin interfaceModel
-
createReifiedStatement
public ReifiedStatement createReifiedStatement(Statement s)
create a ReifiedStatement that encodes _s_ and belongs to this Model.- Specified by:
createReifiedStatementin interfaceModel
-
createReifiedStatement
public ReifiedStatement createReifiedStatement(java.lang.String uri, Statement s)
Description copied from interface:Modelanswer a ReifiedStatement that encodes _s_, belongs to this Model, and is a Resource with that _uri_.- Specified by:
createReifiedStatementin interfaceModel
-
contains
public boolean contains(Statement s)
Description copied from interface:ModelDetermine if a statement is present in this model.
-
containsResource
public boolean containsResource(RDFNode r)
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
public boolean contains(Resource s, Property p)
Description copied from interface:ModelDetermine whether this model contains any statements with a given subject and property.
-
contains
public boolean contains(Resource s, Property p, RDFNode o)
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
public Statement getRequiredProperty(Resource s, Property p)
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
public Statement getRequiredProperty(Resource s, Property p, java.lang.String lang)
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
public Statement getProperty(Resource s, Property p)
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
public Statement getProperty(Resource s, Property p, java.lang.String lang)
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
-
listSubjects
public ResIterator 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
public ResIterator listResourcesWithProperty(Property p)
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
public ResIterator listSubjectsWithProperty(Property p)
Description copied from interface:ModelAn alias forlistResourcesWithProperty(Property), retained for backward compatibility. It may be deprecated in later releases.- Specified by:
listSubjectsWithPropertyin interfaceModel
-
listResourcesWithProperty
public ResIterator listResourcesWithProperty(Property p, RDFNode o)
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
public NodeIterator 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
public NodeIterator listObjectsOfProperty(Property p)
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
public NodeIterator listObjectsOfProperty(Resource s, Property p)
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.
-
listStatements
public StmtIterator listStatements(Selector selector)
Description copied from interface:ModelList the statements matching a selector.A statement is considered to match if the
testmethod of s returns true when called on s.- Specified by:
listStatementsin interfaceModel- Parameters:
selector- A selector object. .- Returns:
- an iterator over the matching statements
-
findTriplesFrom
public ExtendedIterator<Triple> findTriplesFrom(Selector s)
Answer an [extended] iterator which returns the triples in this graph which are selected by the (S, P, O) triple in the selector, ignoring any special tests it may do.- Parameters:
s- a Selector used to supply subject, predicate, and object- Returns:
- an extended iterator over the matching (S, P, O) triples
-
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
public Model 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
public Model abort()
Description copied from interface:ModelAbort the current transaction and abandon any changes in progress.
-
commit
public Model commit()
Description copied from interface:ModelCommit the current transaction.
-
executeInTxn
public void executeInTxn(java.lang.Runnable action)
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
public <T> T calculateInTxn(java.util.function.Supplier<T> action)
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
public Resource 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
public Resource createResource(java.lang.String uri)
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.
-
createProperty
public Property createProperty(java.lang.String uri)
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
public Property createProperty(java.lang.String nameSpace, java.lang.String localName)
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
public Statement createStatement(Resource r, Property p, RDFNode o)
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
public Bag createBag(java.lang.String uri)
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
public Alt createAlt(java.lang.String uri)
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
public Seq createSeq(java.lang.String uri)
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
public Statement asStatement(Triple t)
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
public StmtIterator asStatements(java.util.Iterator<Triple> it)
-
listBySubject
public StmtIterator listBySubject(Container cont)
-
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.
-
query
public Model query(Selector selector)
Description copied from interface:ModelCreate a new model containing the statements matching a query.A statement is considered to match if the
testmethod of s returns true when called on s.
-
union
public Model union(Model model)
Description copied from interface:ModelCreate a new, independant, model containing all the statements in this model together with all of those in another given model. By independant 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
public Model intersection(Model other)
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:
Model.intersection(org.apache.jena.rdf.model.Model)
-
intersect
public static Model intersect(Model smaller, Model larger)
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
public Model difference(Model model)
Description copied from interface:ModelCreate a new, independant, 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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
reifiedToString
public java.lang.String reifiedToString()
-
isIsomorphicWith
public boolean isIsomorphicWith(Model m)
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
public Lock getModelLock()
-
getLock
public Lock getLock()
Description copied from interface:ModelGet the model lock for this model. See also the convenience operations enterCriticalSection and leaveCriticalSection.
-
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:
Lock.leaveCriticalSection()
-
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:
Lock.enterCriticalSection(boolean)
-
register
public Model register(ModelChangedListener listener)
Register the listener with this model by registering its GraphListener adaption with the underlying Graph.- Specified by:
registerin interfaceModel- Parameters:
listener- A ModelChangedListener to register for model events- Returns:
- this model, for cascading
- See Also:
ModelChangedListener
-
unregister
public Model unregister(ModelChangedListener listener)
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:
ModelChangedListener
-
adapt
public GraphListener adapt(ModelChangedListener L)
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:
ModelListenerAdapter
-
notifyEvent
public Model notifyEvent(java.lang.Object e)
Description copied from interface:ModelNotify any listeners that the event e has occurred.- Specified by:
notifyEventin interfaceModel- Parameters:
e- the event that has occurred
-
-