public class ModelCom extends EnhGraph implements Model, PrefixMapping, Lock
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.
PrefixMapping.Factory, PrefixMapping.IllegalPrefixException, PrefixMapping.JenaLockedExceptionExtended, Standard| Constructor and Description |
|---|
ModelCom(Graph base)
make a model based on the specified graph
|
ModelCom(Graph base,
Personality<RDFNode> personality) |
| Modifier and Type | Method and Description |
|---|---|
Model |
abort()
Abort the current transaction and abandon any changes in progress.
|
GraphListener |
adapt(ModelChangedListener L)
Answer a GraphListener that, when fed graph-level update events,
fires the corresponding model-level event handlers in
L. |
Model |
add(List<Statement> statements)
Add all the statements to the model by converting the list to an array of
Statement and removing that.
|
Model |
add(Model m)
Add all the statements in another model to this model, including the
reified statements.
|
Model |
add(Resource s,
Property p,
RDFNode o)
add a statement to this model.
|
Model |
add(Resource s,
Property p,
String o)
add a statement to this model.
|
Model |
add(Resource s,
Property p,
String o,
boolean wellFormed)
add a statement to this model.
|
Model |
add(Resource s,
Property p,
String lex,
RDFDatatype datatype)
add a statement to this model.
|
Model |
add(Resource s,
Property p,
String o,
String l)
add a statement to this model.
|
Model |
add(Resource s,
Property p,
String o,
String lang,
boolean wellFormed) |
Model |
add(Statement s)
add a Statement to this Model by adding its SPO components.
|
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.
|
Model |
add(StmtIterator iter)
Add all the statements returned by an iterator to this model.
|
Model |
addLiteral(Resource s,
Property p,
boolean o)
Add the statement (s, p, createTypedLiteral( o )) to this model and
answer this model.
|
Model |
addLiteral(Resource s,
Property p,
char o)
Add the statement (s, p, createTypedLiteral( o )) to this model and
answer this model.
|
Model |
addLiteral(Resource s,
Property p,
double o)
Add the statement (s, p, o') to the model, where o' is the typed
literal corresponding to o.
|
Model |
addLiteral(Resource s,
Property p,
float o)
Add the statement (s, p, o') to the model, where o' is the typed
literal corresponding to o.
|
Model |
addLiteral(Resource s,
Property p,
int o)
Add the statement (s, p, createTypedLiteral( o )) to this model and
answer this model.
|
Model |
addLiteral(Resource s,
Property p,
Literal o)
add a statement to this model.
|
Model |
addLiteral(Resource s,
Property p,
long o)
Add the statement (s, p, createTypedLiteral( o )) to this model and
answer this model.
|
Model |
addLiteral(Resource s,
Property p,
Object o)
Deprecated.
|
static void |
addNamespaces(Model m,
Map<String,Set<String>> ns)
Service method to update the namespaces of a Model given the
mappings from prefix names to sets of URIs.
|
Model |
asModel(Graph g) |
static Node |
asNode(RDFNode x) |
RDFNode |
asRDFNode(Node n)
Answer an RDF node wrapping
n suitably; URI nodes
become Resources with the same URI, blank nodes become Resources
with URI null but the same AnonId, and literal nodes become Literals
with n as their value carrier. |
Statement |
asStatement(Triple t)
Answer a Statement in this Model which encodes the given Triple.
|
StmtIterator |
asStatements(Iterator<Triple> it) |
List<Statement> |
asStatements(List<Triple> triples) |
Statement[] |
asStatements(Triple[] triples) |
Model |
begin()
Begin a new transaction.
|
<T> T |
calculateInTxn(Supplier<T> action)
Execute the supplier
action within a transaction. |
Model |
clearNsPrefixMap()
Clear this prefix mapping of all mappings
|
void |
close()
Close the Model and free up resources held.
|
Model |
commit()
Commit the current transaction.
|
boolean |
contains(Resource s,
Property p)
Determine whether this model contains any statements with a given subject
and property.
|
boolean |
contains(Resource s,
Property p,
RDFNode o)
Determine if an (S, P, O) pattern is present in this model, with null allowed
to represent a wildcard match.
|
boolean |
contains(Resource s,
Property p,
String o)
Determine if a statement is present in this model.
|
boolean |
contains(Resource s,
Property p,
String o,
String l)
Determine if a statement is present in this model.
|
boolean |
contains(Statement s)
Determine if a statement is present in this model.
|
boolean |
containsAll(Model model)
Determine if all of the statements in a model are also contained
in this model.
|
boolean |
containsAll(StmtIterator iter)
Determine if all of the statements returned by an iterator are
contained in this model.
|
boolean |
containsAny(Model model)
Determine if any of the statements in a model are also contained
in this model.
|
boolean |
containsAny(StmtIterator iter)
Determine if any of the statements returned by an iterator are
contained in this model.
|
boolean |
containsLiteral(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.
|
boolean |
containsLiteral(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.
|
boolean |
containsLiteral(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.
|
boolean |
containsLiteral(Resource s,
Property p,
float o)
Answer true iff this model contains (s, p, o') where o' is the typed
literal corresponding to o.
|
boolean |
containsLiteral(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.
|
boolean |
containsLiteral(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.
|
boolean |
containsLiteral(Resource s,
Property p,
Object o)
Answer true iff this model contains the statement (s, p, o') where
o' is the typed literal corresponding to the value o.
|
boolean |
containsResource(RDFNode r)
determine if the RDFNode r appears in any statement of this model.
|
Alt |
createAlt()
Create a new anonymous alt.
|
Alt |
createAlt(String uri)
Create a new alt.
|
Bag |
createBag()
Create a new anonymous bag.
|
Bag |
createBag(String uri)
Create a new bag.
|
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.
|
RDFList |
createList(Iterator<? extends RDFNode> members)
Answer a new list containing the resources from the given iterator, in order.
|
RDFList |
createList(RDFNode... members)
Answer a new list containing the RDF nodes from the given array, in order
|
Literal |
createLiteral(String v)
create a literal from a String value.
|
Literal |
createLiteral(String v,
boolean wellFormed)
Create a literal from a String value.
|
Literal |
createLiteral(String v,
String l)
Create an untyped literal from a String value with a specified language.
|
Literal |
createLiteral(String v,
String l,
boolean wellFormed) |
Statement |
createLiteralStatement(Resource r,
Property p,
boolean o)
Answer a new Statement object (s, p, o') where o' is the typed literal
corresponding to o using createTypedLiteral.
|
Statement |
createLiteralStatement(Resource r,
Property p,
char o)
Answer a new Statement object (s, p, o') where o' is the typed literal
corresponding to o using createTypedLiteral.
|
Statement |
createLiteralStatement(Resource r,
Property p,
double o)
Answer a new Statement object (s, p, o') where o' is the typed literal
corresponding to o using createTypedLiteral.
|
Statement |
createLiteralStatement(Resource r,
Property p,
float o)
Answer a new Statement object (s, p, o') where o' is the typed literal
corresponding to o using createTypedLiteral.
|
Statement |
createLiteralStatement(Resource r,
Property p,
int o)
Answer a new Statement object (s, p, o') where o' is the typed literal
corresponding to o using createTypedLiteral.
|
Statement |
createLiteralStatement(Resource r,
Property p,
long o)
Answer a new Statement object (s, p, o') where o' is the typed literal
corresponding to o using createTypedLiteral.
|
Statement |
createLiteralStatement(Resource r,
Property p,
Object o)
Answer a new Statement object (s, p, o') where o' is the typed literal
corresponding to o using createTypedLiteral.
|
Property |
createProperty(String uri)
Create a property.
|
Property |
createProperty(String nameSpace,
String localName)
Create a property with a given URI composed from a namespace part and a
localname part by concatenating the strings.
|
ReifiedStatement |
createReifiedStatement(Statement s)
create a ReifiedStatement that encodes _s_ and belongs to this Model.
|
ReifiedStatement |
createReifiedStatement(String uri,
Statement s)
answer a ReifiedStatement that encodes _s_, belongs to this Model,
and is a Resource with that _uri_.
|
Resource |
createResource()
Create a new anonymous resource whose model is this model.
|
Resource |
createResource(AnonId id)
Create a blank node resource with a specified identifier.
|
Resource |
createResource(Resource type)
Create a new anonymous resource with a given type.
|
Resource |
createResource(ResourceF f)
Deprecated.
|
Resource |
createResource(Statement statement)
Create a resource that represents a statement.
|
Resource |
createResource(String uri)
Create a new resource associated with this model.
|
Resource |
createResource(String uri,
Resource type)
Create a new resource with a given type.
|
Resource |
createResource(String uri,
ResourceF f)
Deprecated.
|
Seq |
createSeq()
Create a new anonymous seq.
|
Seq |
createSeq(String uri)
Create a new seq.
|
Statement |
createStatement(Resource r,
Property p,
RDFNode o)
create a Statement from the given r, p, and o.
|
Statement |
createStatement(Resource r,
Property p,
String o)
Create a Statement instance.
|
Statement |
createStatement(Resource r,
Property p,
String o,
boolean wellFormed)
Create a Statement instance.
|
Statement |
createStatement(Resource r,
Property p,
String o,
String l)
Create a Statement instance.
|
Statement |
createStatement(Resource r,
Property p,
String o,
String l,
boolean wellFormed)
Create a Statement instance.
|
Literal |
createTypedLiteral(boolean v)
create a type literal from a boolean value.
|
Literal |
createTypedLiteral(Calendar cal)
Create a typed literal xsd:dateTime from a Calendar object.
|
Literal |
createTypedLiteral(char v)
create a typed literal from a char value.
|
Literal |
createTypedLiteral(double v)
create a typed literal from a double value.
|
Literal |
createTypedLiteral(float v)
create a typed literal from a float value.
|
Literal |
createTypedLiteral(int v)
create a typed literal from an integer value.
|
Literal |
createTypedLiteral(long v)
create a typed literal from a long integer value.
|
Literal |
createTypedLiteral(Object value)
Build a typed literal label from its value form using
whatever datatype is currently registered as the the default
representation for this java class.
|
Literal |
createTypedLiteral(Object value,
RDFDatatype dtype)
Build a typed literal from its value form.
|
Literal |
createTypedLiteral(Object value,
String typeURI)
Build a typed literal from its value form.
|
Literal |
createTypedLiteral(String v)
create a typed literal from a String value.
|
Literal |
createTypedLiteral(String lex,
RDFDatatype dtype)
Build a typed literal from its lexical form.
|
Literal |
createTypedLiteral(String lex,
String typeURI)
Build a typed literal from its lexical form.
|
Model |
difference(Model model)
Create a new, independant, model containing all the statements in this model which
are not in another.
|
void |
enterCriticalSection(boolean requestReadLock)
Enter a critical section.
|
Object |
executeInTransaction(Command cmd)
If transactions are supported, execute the command c within a transaction
and return its result.
|
void |
executeInTxn(Runnable action)
Execute the runnable
action within a transaction. |
String |
expandPrefix(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.
|
Alt |
getAlt(Resource r)
Return an Alt instance based on a given resource.
|
Alt |
getAlt(String uri)
Return an Alt instance in this model.
|
Resource |
getAnyReifiedStatement(Statement s)
get any reification of the given statement in this model; make
one if necessary.
|
Bag |
getBag(Resource r)
Return a bag instance based on a given resource.
|
Bag |
getBag(String uri)
Return a Bag instance in this model.
|
static PrefixMapping |
getDefaultModelPrefixes()
Deprecated.
This feature will be removed
|
Graph |
getGraph()
Answer the Graph which this Model is presenting.
|
RDFList |
getList(Resource r)
Return a RDF List based on a given resource.
|
RDFList |
getList(String uri)
Return a RDF List instance in this model.
|
Lock |
getLock()
Get the model lock for this model.
|
Lock |
getModelLock() |
Map<String,String> |
getNsPrefixMap()
Return a copy of the internal mapping from names to URI strings.
|
String |
getNsPrefixURI(String prefix)
Get the URI bound to a specific prefix, null if there isn't one.
|
String |
getNsURIPrefix(String uri)
Answer the prefix for the given URI, or null if there isn't one.
|
Statement |
getProperty(Resource s,
Property p)
Answer a statement (s, p, ?O) from this model.
|
Statement |
getProperty(Resource s,
Property p,
String lang)
Answer a statement (s, p, ?O) from this model.
|
Property |
getProperty(String uri)
Return a Property instance in this model.
|
Property |
getProperty(String nameSpace,
String localName)
Return a Property instance with the given URI in this model.
|
RDFNode |
getRDFNode(Node n)
|
RDFReader |
getReader()
return an RDFReader instance for the default serialization language.
|
RDFReader |
getReader(String lang)
return an RDFReader instance for the specified serialization language.
|
Statement |
getRequiredProperty(Resource s,
Property p)
Return a statement with given subject and property.
|
Statement |
getRequiredProperty(Resource s,
Property p,
String lang)
Return a statement with given subject and property.
|
Resource |
getResource(String uri)
Return a Resource instance with the given URI in this model.
|
Resource |
getResource(String uri,
ResourceF f)
Deprecated.
|
Seq |
getSeq(Resource r)
Return a Seq instance based on a given resource.
|
Seq |
getSeq(String uri)
Return a Seq instance in this model.
|
RDFWriter |
getWriter()
Get the model's writer after priming it with the model's namespace
prefixes.
|
RDFWriter |
getWriter(String lang)
Get the model's writer after priming it with the model's namespace
prefixes.
|
boolean |
hasNoMappings()
Return whether the prefix mapping has any defined prefixes.
|
boolean |
independent()
Determine whether this model is independent.
|
static Model |
intersect(Model smaller,
Model larger)
Answer a Model that is the intersection of the two argument models.
|
Model |
intersection(Model other)
Intersect this with another model.
|
boolean |
isClosed()
Answer true iff .close() has been called on this Model.
|
boolean |
isEmpty()
Answer true iff the model contains no explicit statements (ie it's size is zero,
listStatements() would deliver the empty iterator).
|
boolean |
isIsomorphicWith(Model m)
Answer whether or not these two graphs are isomorphic.
|
boolean |
isReified(Statement s)
Determine if this Statement has been reified in this Model.
|
void |
leaveCriticalSection()
Leave a critical section.
|
StmtIterator |
listBySubject(Container cont) |
StmtIterator |
listLiteralStatements(Resource S,
Property P,
boolean O)
Answer a statement iterator that will iterate over all the statements
(S, P, O) in this model where S matches
subject, P
matches predicate, and O matches the typed literal
corresponding to object. |
StmtIterator |
listLiteralStatements(Resource S,
Property P,
char O)
Answer a statement iterator that will iterate over all the statements
(S, P, O) in this model where S matches
subject, P
matches predicate, and O matches the typed literal
corresponding to object. |
StmtIterator |
listLiteralStatements(Resource S,
Property P,
double O)
Answer a statement iterator that will iterate over all the statements
(S, P, O) in this model where S matches
subject, P
matches predicate, and O matches the typed literal
corresponding to object. |
StmtIterator |
listLiteralStatements(Resource S,
Property P,
float O)
Answer a statement iterator that will iterate over all the statements
(S, P, O) in this model where S matches
subject, P
matches predicate, and O matches the typed literal
corresponding to object. |
StmtIterator |
listLiteralStatements(Resource S,
Property P,
int O)
Answer a statement iterator that will iterate over all the statements
(S, P, O) in this model where S matches
subject, P
matches predicate, and O matches the typed literal
corresponding to object. |
StmtIterator |
listLiteralStatements(Resource S,
Property P,
long O)
Answer a statement iterator that will iterate over all the statements
(S, P, O) in this model where S matches
subject, P
matches predicate, and O matches the typed literal
corresponding to object. |
NsIterator |
listNameSpaces()
(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.
|
NodeIterator |
listObjects()
List all objects in a model.
|
NodeIterator |
listObjectsOfProperty(Property p)
List all objects of a given property.
|
NodeIterator |
listObjectsOfProperty(Resource s,
Property p)
List the values of a property of a resource.
|
RSIterator |
listReifiedStatements()
answer an iterator delivering all the reified statements "in" this model
|
RSIterator |
listReifiedStatements(Statement st)
answer an iterator delivering all the reified statements "in" this model
that match the statement _st_.
|
ResIterator |
listResourcesWithProperty(Property p)
Answer an iterator [with no duplicates] over all the resources in this
model that have property
p. |
ResIterator |
listResourcesWithProperty(Property p,
boolean o)
Answer an iterator [without duplicates] over all the resources in this
model which have value o' for property p, where o' is the typed literal
corresponding to o.
|
ResIterator |
listResourcesWithProperty(Property p,
char o)
Answer an iterator [without duplicates] over all the resources in this
model which have value o' for property p, where o' is the typed literal
corresponding to o.
|
ResIterator |
listResourcesWithProperty(Property p,
double o)
Answer an iterator [without duplicates] over all the resources in this
model which have value o' for property p, where o' is the typed literal
corresponding to o.
|
ResIterator |
listResourcesWithProperty(Property p,
float o)
Answer an iterator [without duplicates] over all the resources in this
model which have value o' for property p, where o' is the typed literal
corresponding to o.
|
ResIterator |
listResourcesWithProperty(Property p,
long o)
Answer an iterator [without duplicates] over all the resources in this
model which have value o' for property p, where o' is the typed literal
corresponding to o.
|
ResIterator |
listResourcesWithProperty(Property p,
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.
|
ResIterator |
listResourcesWithProperty(Property p,
RDFNode o)
Answer an iterator [with no duplicates] over all the resources in this
model that have property
p with value o. |
StmtIterator |
listStatements()
List all statements.
|
StmtIterator |
listStatements(Resource S,
Property P,
RDFNode O)
Find all the statements matching a pattern.
|
StmtIterator |
listStatements(Resource S,
Property P,
String O)
Find all the statements matching a pattern.
|
StmtIterator |
listStatements(Resource S,
Property P,
String O,
String L)
Find all the statements matching a pattern.
|
StmtIterator |
listStatements(Selector selector)
List the statements matching a selector.
|
ResIterator |
listSubjects()
List all resources which are subjects of statements.
|
ResIterator |
listSubjectsWithProperty(Property p)
An alias for
listResourcesWithProperty(Property),
retained for backward compatibility. |
ResIterator |
listSubjectsWithProperty(Property p,
RDFNode o)
An alias for
listResourcesWithProperty, retained for
backward compatibility. |
ResIterator |
listSubjectsWithProperty(Property p,
String o)
lists all subjects with a given property and property value.
|
ResIterator |
listSubjectsWithProperty(Property p,
String o,
String l)
lists all subjects with a given property and property value.
|
PrefixMapping |
lock()
Lock the PrefixMapping so that changes can no longer be made to it.
|
Model |
notifyEvent(Object e)
Notify any listeners that the event e has occurred.
|
int |
numPrefixes()
Return the number of defined prefixes.
|
String |
qnameFor(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.
|
Model |
query(Selector selector)
Create a new model containing the statements matching a query.
|
Model |
read(InputStream reader,
String base)
Add statements from a document.
|
Model |
read(InputStream reader,
String base,
String lang)
Add RDF statements represented in language
lang to the model. |
Model |
read(Reader reader,
String base)
Using this method is often a mistake.
|
Model |
read(Reader reader,
String base,
String lang)
Using this method is often a mistake.
|
Model |
read(String url)
Add the RDF statements from a document.
|
Model |
read(String url,
String lang)
Add statements from a serializion in language
lang to the
model. |
Model |
read(String url,
String base,
String lang)
Read into this model the RDF at
url, using
baseURI as the base URI if it is non-null. |
Model |
register(ModelChangedListener listener)
Register the listener with this model by registering its GraphListener
adaption with the underlying Graph.
|
String |
reifiedToString() |
Model |
remove(List<Statement> statements)
Remove all the Statements from the model by converting the List to a
List(Statement) and removing that.
|
Model |
remove(Model m)
Remove all the Statements in a given model, including reified statements
|
Model |
remove(Resource s,
Property p,
RDFNode o)
remove the statement
(s, p, o) from this model and
answer this model. |
Model |
remove(Statement s)
Removes a statement.
|
Model |
remove(Statement[] statements)
remove all the Statements from the model by converting them to triples and
removing those triples from the underlying graph.
|
Model |
remove(StmtIterator iter)
Remove all the Statements returned by an iterator.
|
Model |
removeAll()
Remove all the statements from this model.
|
Model |
removeAll(Resource s,
Property p,
RDFNode o)
Remove all the statements matching (s, p, o) from this model.
|
void |
removeAllReifications(Statement s)
remove any ReifiedStatements reifying the given statement
|
Model |
removeNsPrefix(String prefix)
Remove any existing maplet with the given prefix name and answer this
mapping.
|
String |
removeReader(String lang)
Deprecated.
|
void |
removeReification(ReifiedStatement rs)
Remove a particular reificiation.
|
String |
removeWriter(String lang)
Deprecated.
|
void |
resetRDFReaderF()
Deprecated.
|
void |
resetRDFWriterF()
Deprecated.
|
boolean |
samePrefixMappingAs(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.
|
static PrefixMapping |
setDefaultModelPrefixes(PrefixMapping pm)
Deprecated.
This feature will be removed
|
Model |
setNsPrefix(String prefix,
String uri)
Specify the prefix name for a URI prefix string.
|
Model |
setNsPrefixes(Map<String,String> map)
Copies the prefix mapping from other into this.
|
Model |
setNsPrefixes(PrefixMapping pm)
Copies the prefixes from other into this.
|
String |
setReaderClassName(String lang,
String className)
Deprecated.
Use
org.apache.jena.riot.RDFParserRegistry.register |
String |
setWriterClassName(String lang,
String className)
Deprecated.
Use
org.apache.jena.riot.RDFWriterRegistry.register |
String |
shortForm(String uri)
Compress the URI using the prefix mappings if possible.
|
long |
size()
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.
|
boolean |
supportsSetOperations()
Determine whether this model supports set operations.
|
boolean |
supportsTransactions()
Determine whether this model supports transactions.
|
String |
toString() |
Model |
union(Model model)
Create a new, independant, model containing all the statements in this model
together with all of those in another given model.
|
Model |
unregister(ModelChangedListener listener)
Unregister the listener from this model by unregistering its GraphListener
adaption from the underlying Graph.
|
Model |
withDefaultMappings(PrefixMapping other)
Update this PrefixMapping with the bindings in
map, only
adding those (p, u) pairs for which neither p nor u appears in this mapping. |
Resource |
wrapAsResource(Node n) |
Model |
write(OutputStream writer)
Write a serialization of this model as an XML document.
|
Model |
write(OutputStream writer,
String lang)
Write a serialized representation of this model in a specified language.
|
Model |
write(OutputStream writer,
String lang,
String base)
Write a serialized representation of a model in a specified language.
|
Model |
write(Writer writer)
Write the model as an XML document.
|
Model |
write(Writer writer,
String lang)
Write a serialized representation of a model in a specified language.
|
Model |
write(Writer writer,
String lang,
String base)
Write a serialized representation of a model in a specified language.
|
asGraph, equals, getNodeAs, hashCode, isIsomorphicWith, setNodeCachepublic ModelCom(Graph base)
public ModelCom(Graph base, Personality<RDFNode> personality)
@Deprecated public static PrefixMapping getDefaultModelPrefixes()
@Deprecated public static PrefixMapping setDefaultModelPrefixes(PrefixMapping pm)
public Graph getGraph()
ModelGraphInterfacegetGraph in interface ModelGraphInterfacepublic RDFNode asRDFNode(Node n)
ModelGraphInterfacen suitably; URI nodes
become Resources with the same URI, blank nodes become Resources
with URI null but the same AnonId, and literal nodes become Literals
with n as their value carrier.asRDFNode in interface ModelGraphInterfacepublic Resource wrapAsResource(Node n)
wrapAsResource in interface ModelGraphInterface@Deprecated public Resource getResource(String uri, ResourceF f)
ModelConSubsequent operations on the returned object may modify this model.
The resource is assumed to already exist in the model. If it does not,
createResource should be used instead.
getResource in interface ModelConuri - the URI of the resourcef - the factory objectpublic Model addLiteral(Resource s, Property p, boolean o)
ModelConaddLiteral in interface ModelConpublic Model addLiteral(Resource s, Property p, long o)
ModelConaddLiteral in interface ModelConpublic Model addLiteral(Resource s, Property p, int o)
ModelConaddLiteral in interface ModelConpublic Model addLiteral(Resource s, Property p, char o)
ModelConaddLiteral in interface ModelConpublic Model addLiteral(Resource s, Property p, float o)
ModelConaddLiteral in interface ModelConpublic Model addLiteral(Resource s, Property p, double o)
ModelConaddLiteral in interface ModelConpublic Model add(Resource s, Property p, String o)
ModelConpublic Model add(Resource s, Property p, String o, boolean wellFormed)
ModelConpublic Model add(Resource s, Property p, String lex, RDFDatatype datatype)
ModelConpublic Model add(Resource s, Property p, String o, String l)
ModelCon@Deprecated public Model addLiteral(Resource s, Property p, Object o)
ModelConaddLiteral in interface ModelCons - the subject of the statement to addp - the predicate of the statement to addo - the object of the statement to addpublic Model addLiteral(Resource s, Property p, Literal o)
ModelConaddLiteral in interface ModelCons - the subject of the statement to addp - the predicate of the statement to addo - the object of the statement to addpublic Model add(StmtIterator iter)
Modelpublic Model add(Model m)
Modelpublic RDFReader getReader()
RDFReaderFgetReader in interface RDFReaderFpublic RDFReader getReader(String lang)
RDFReaderFgetReader in interface RDFReaderFlang - the serialization language - null selects the
default@Deprecated public String setReaderClassName(String lang, String className)
org.apache.jena.riot.RDFParserRegistry.registerRDFReaderFsetReaderClassName in interface RDFReaderFlang - the language for which this class should be usedclassName - the class name for readers for this language@Deprecated public void resetRDFReaderF()
RDFReaderFresetRDFReaderF in interface RDFReaderF@Deprecated public String removeReader(String lang) throws IllegalArgumentException
RDFReaderFremoveReader in interface RDFReaderFlang - The lang to remove.IllegalArgumentException - if lang is one of the initial languagespublic Model read(String url)
ModelSee Model for a description of how to traverse a firewall.
See "Reading and Writing RDF in Apache Jena" for more information about determining the syntax.
public Model read(Reader reader, String base)
ModelModel.read(InputStream, String, String) for explicitily setting the serialization language.
See "Reading and Writing RDF in Apache Jena" for more information about concrete syntaxes.
public Model read(InputStream reader, String base)
ModelModel.read(InputStream, String, String) for explicitly setting the language.
See "Reading and Writing RDF in Apache Jena" for more information about concrete syntaxes.
read in interface Modelreader - 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 be null.
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.public Model read(String url, String lang)
Modellang to the
model.
lang are "RDF/XML", "N-TRIPLE",
"TURTLE" (or "TTL") and "N3".
null represents the default language, "RDF/XML".
"RDF/XML-ABBREV" is a synonym for "RDF/XML".
See Model for a description of how to traverse a firewall.
See "Reading and Writing RDF in Apache Jena" for more information about concrete syntaxes.
public Model read(String url, String base, String lang)
Modelurl, using
baseURI as the base URI if it is non-null. The RDF is assumed
to be RDF/XML unless lang is non-null, in which case it names
the language to be used. Answer this model.public Model read(Reader reader, String base, String lang)
Modellang to the model.
lang are "RDF/XML", "N-TRIPLE",
"TURTLE" (or "TTL") and "N3".
null represents the default language, "RDF/XML".
"RDF/XML-ABBREV" is a synonym for "RDF/XML".
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.read in interface Modelreader - 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 be null.
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 serialization null
selects the defaultpublic Model read(InputStream reader, String base, String lang)
Modellang to the model.
lang are "RDF/XML", "N-TRIPLE",
"TURTLE" (or "TTL") and "N3".
null represents the default language, "RDF/XML".
"RDF/XML-ABBREV" is a synonym for "RDF/XML".
read in interface Modelreader - 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 be null.
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 serialization null
selects the defaultpublic RDFWriter getWriter()
getWriter in interface RDFWriterFpublic RDFWriter getWriter(String lang)
getWriter in interface RDFWriterFlang - the serialization language - null selects the
default@Deprecated public String setWriterClassName(String lang, String className)
org.apache.jena.riot.RDFWriterRegistry.registerRDFWriterFsetWriterClassName in interface RDFWriterFlang - the language for which this class should be usedclassName - the class name for writers for this language@Deprecated public void resetRDFWriterF()
RDFWriterFresetRDFWriterF in interface RDFWriterF@Deprecated public String removeWriter(String lang) throws IllegalArgumentException
RDFWriterFremoveWriter in interface RDFWriterFlang - The lang to remove.IllegalArgumentException - if lang is one of the initial languagespublic Model write(Writer writer)
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.
public Model write(Writer writer, String lang)
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
lang argument. Predefined values are "RDF/XML",
"RDF/XML-ABBREV", "N-TRIPLE", "TURTLE", (and "TTL") and "N3". The default value,
represented by null is "RDF/XML".
public Model write(Writer writer, String lang, String base)
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
lang argument. Predefined values are "RDF/XML",
"RDF/XML-ABBREV", "N-TRIPLE", "TURTLE", (and "TTL") and "N3". The default value,
represented by null, is "RDF/XML".
public Model write(OutputStream writer)
ModelWrite a serialization of this model as an XML document.
The language in which to write the model is specified by the
lang argument. Predefined values are "RDF/XML",
"RDF/XML-ABBREV", "N-TRIPLE" and "N3". The default value is
represented by null is "RDF/XML".
public Model write(OutputStream writer, String lang)
ModelWrite a serialized representation of this model in a specified language.
The language in which to write the model is specified by the
lang argument. Predefined values are "RDF/XML",
"RDF/XML-ABBREV", "N-TRIPLE", "TURTLE", (and "TTL") and "N3". The default value,
represented by null, is "RDF/XML".
public Model write(OutputStream writer, String lang, String base)
ModelWrite a serialized representation of a model in a specified language.
The language in which to write the model is specified by the
lang argument. Predefined values are "RDF/XML",
"RDF/XML-ABBREV", "N-TRIPLE", "TURTLE", (and "TTL") and "N3". The default value,
represented by null, is "RDF/XML".
write in interface Modelwriter - 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. null
means use only absolute URI's. This is used for relative
URIs that would be resolved against the document retrieval URL.
For some values of lang, this value may be included in the output.public Model remove(Statement s)
ModelThe statement with the same subject, predicate and object as that supplied will be removed from the model.
public Model remove(Resource s, Property p, RDFNode o)
ModelCon(s, p, o) from this model and
answer this model. None of s, p, o are permitted to
be null: for wildcard removal, see removeAll.public Model remove(StmtIterator iter)
ModelConpublic Model remove(Model m)
ModelConpublic Model removeAll()
Modelpublic Model removeAll(Resource s, Property p, RDFNode o)
Modelpublic boolean containsLiteral(Resource s, Property p, boolean o)
ModelConcontainsLiteral in interface ModelConpublic boolean containsLiteral(Resource s, Property p, long o)
ModelConcontainsLiteral in interface ModelConpublic boolean containsLiteral(Resource s, Property p, int o)
ModelConcontainsLiteral in interface ModelConpublic boolean containsLiteral(Resource s, Property p, char o)
ModelConcontainsLiteral in interface ModelConpublic boolean containsLiteral(Resource s, Property p, float o)
ModelConcontainsLiteral in interface ModelConpublic boolean containsLiteral(Resource s, Property p, double o)
ModelConcontainsLiteral in interface ModelConpublic boolean contains(Resource s, Property p, String o)
ModelConpublic boolean contains(Resource s, Property p, String o, String l)
ModelConcontains in interface ModelCons - 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 objectpublic boolean containsLiteral(Resource s, Property p, Object o)
ModelConcontainsLiteral in interface ModelConpublic boolean containsAny(Model model)
ModelcontainsAny in interface Modelmodel - the model containing the statements to be testedpublic boolean containsAll(Model model)
ModelcontainsAll in interface Modelmodel - the model containing the statements to be testedpublic boolean containsAny(StmtIterator iter)
ModelcontainsAny in interface Modeliter - an iterator of the statements to be testedpublic boolean containsAll(StmtIterator iter)
ModelcontainsAll in interface Modeliter - an iterator of the statements to be testedpublic StmtIterator listStatements(Resource S, Property P, RDFNode O)
ModelReturn an iterator over all the statements in a model
that match a pattern. The statements selected are those
whose subject matches the subject argument,
whose predicate matches the predicate argument
and whose object matches the object argument.
If an argument is null it matches anything.
listStatements in interface ModelS - The subject soughtP - The predicate soughtO - The value soughtpublic StmtIterator listStatements(Resource S, Property P, String O)
ModelConReturn an iterator over all the statements in a model
that match a pattern. The statements selected are those
whose subject matches the subject argument,
whose predicate matches the predicate argument
and whose object matchesthe object argument.
listStatements in interface ModelConS - The subject soughtP - The predicate soughtO - The value soughtpublic StmtIterator listStatements(Resource S, Property P, String O, String L)
ModelConReturn an iterator over all the statements in a model
that match a pattern. The statements selected are those
whose subject matches the subject argument,
whose predicate matches the predicate argument
and whose object matchesthe object argument.
If an argument is null it matches anything.
listStatements in interface ModelConS - The subject soughtP - The predicate soughtO - The value soughtL - The lang code ofthe string.public StmtIterator listLiteralStatements(Resource S, Property P, boolean O)
ModelConsubject, P
matches predicate, and O matches the typed literal
corresponding to object.listLiteralStatements in interface ModelConpublic StmtIterator listLiteralStatements(Resource S, Property P, long O)
ModelConsubject, P
matches predicate, and O matches the typed literal
corresponding to object.listLiteralStatements in interface ModelConpublic StmtIterator listLiteralStatements(Resource S, Property P, int O)
ModelConsubject, P
matches predicate, and O matches the typed literal
corresponding to object.listLiteralStatements in interface ModelConpublic StmtIterator listLiteralStatements(Resource S, Property P, char O)
ModelConsubject, P
matches predicate, and O matches the typed literal
corresponding to object.listLiteralStatements in interface ModelConpublic StmtIterator listLiteralStatements(Resource S, Property P, float O)
ModelConsubject, P
matches predicate, and O matches the typed literal
corresponding to object.listLiteralStatements in interface ModelConpublic StmtIterator listLiteralStatements(Resource S, Property P, double O)
ModelConsubject, P
matches predicate, and O matches the typed literal
corresponding to object.listLiteralStatements in interface ModelConpublic ResIterator listResourcesWithProperty(Property p, boolean o)
ModelConlistResourcesWithProperty in interface ModelConpublic ResIterator listResourcesWithProperty(Property p, char o)
ModelConlistResourcesWithProperty in interface ModelConpublic ResIterator listResourcesWithProperty(Property p, long o)
ModelConlistResourcesWithProperty in interface ModelConpublic ResIterator listResourcesWithProperty(Property p, float o)
ModelConlistResourcesWithProperty in interface ModelConpublic ResIterator listResourcesWithProperty(Property p, double o)
ModelConlistResourcesWithProperty in interface ModelConpublic ResIterator listResourcesWithProperty(Property p, Object o)
ModelConlistResourcesWithProperty in interface ModelConpublic ResIterator listSubjectsWithProperty(Property p, RDFNode o)
ModellistResourcesWithProperty, retained for
backward compatibility. It may be deprecated in later releases.listSubjectsWithProperty in interface Modelpublic ResIterator listSubjectsWithProperty(Property p, String o)
ModelConlistSubjectsWithProperty in interface ModelConp - The predicate sought.o - The property value sought.public ResIterator listSubjectsWithProperty(Property p, String o, String l)
ModelConlistSubjectsWithProperty in interface ModelConp - The predicate sought.o - The property value sought.l - the language associated with the objectpublic Resource createResource(Resource type)
ModelConSubsequent 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.
createResource in interface ModelContype - the type of the resource to be created.public Resource createResource(String uri, Resource type)
ModelConSubsequent 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.
createResource in interface ModelConuri - The URI of the new resource.type - the type of the resource to be created.@Deprecated public Resource createResource(ResourceF f)
ModelConSubsequent operations on the returned resource may modify this model.
createResource in interface ModelConf - A factory object to create the returned object.
.public Resource createResource(AnonId id)
ModelThis 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
createResource in interface Modelid - the identifier to use for this blank nodepublic Resource createResource(Statement statement)
ModelcreateResource in interface Model@Deprecated public Resource createResource(String uri, ResourceF f)
ModelConSubsequent operations on the returned resource may modify this model.
createResource in interface ModelConuri - the URI of the resourcef - A factory to create the returned object.
.public Literal createTypedLiteral(boolean v)
The value is converted to a string using its toString
method.
createTypedLiteral in interface ModelConv - the value of the literalpublic Literal createTypedLiteral(int v)
createTypedLiteral in interface ModelConv - the value of the literalpublic Literal createTypedLiteral(long v)
createTypedLiteral in interface ModelConv - the value of the literalpublic Literal createTypedLiteral(char v)
createTypedLiteral in interface ModelConv - the value of the literalpublic Literal createTypedLiteral(float v)
createTypedLiteral in interface ModelConv - the value of the literalpublic Literal createTypedLiteral(double v)
createTypedLiteral in interface ModelConv - the value of the literalpublic Literal createTypedLiteral(String v)
createTypedLiteral in interface ModelConv - the value of the literalpublic Literal createTypedLiteral(Calendar cal)
createTypedLiteral in interface ModelConpublic Literal createTypedLiteral(String lex, RDFDatatype dtype) throws DatatypeFormatException
createTypedLiteral in interface Modellex - the lexical form of the literaldtype - the type of the literal, null for old style "plain" literalsDatatypeFormatException - if lex is not a legal form of dtypepublic Literal createTypedLiteral(Object value, RDFDatatype dtype)
createTypedLiteral in interface Modelvalue - the value of the literaldtype - the type of the literal, null for old style "plain" literalspublic Literal createTypedLiteral(String lex, String typeURI)
createTypedLiteral in interface ModelConlex - the lexical form of the literaltypeURI - the uri of the type of the literal, null for old style "plain" literalsDatatypeFormatException - if lex is not a legal form of dtypepublic Literal createTypedLiteral(Object value, String typeURI)
createTypedLiteral in interface ModelConvalue - the value of the literaltypeURI - the URI of the type of the literal, null for old style "plain" literalspublic Literal createTypedLiteral(Object value)
createTypedLiteral in interface ModelcreateTypedLiteral in interface ModelConvalue - the literal value to encapsulatepublic Literal createLiteral(String v)
ModelConcreateLiteral in interface ModelConv - the value of the literalpublic Literal createLiteral(String v, String l)
ModelcreateLiteral in interface Modelv - the lexical form of the literall - the language associated with the literalpublic Literal createLiteral(String v, boolean wellFormed)
ModelcreateLiteral in interface Modelv - the lexical form of the literalwellFormed - true if the Literal is well formed XML, in the lexical space of rdf:XMLLiteralpublic Statement createLiteralStatement(Resource r, Property p, boolean o)
ModelConcreateLiteralStatement in interface ModelConpublic Statement createLiteralStatement(Resource r, Property p, long o)
ModelConcreateLiteralStatement in interface ModelConpublic Statement createLiteralStatement(Resource r, Property p, int o)
ModelConcreateLiteralStatement in interface ModelConpublic Statement createLiteralStatement(Resource r, Property p, char o)
ModelConcreateLiteralStatement in interface ModelConpublic Statement createLiteralStatement(Resource r, Property p, float o)
ModelConcreateLiteralStatement in interface ModelConpublic Statement createLiteralStatement(Resource r, Property p, double o)
ModelConcreateLiteralStatement in interface ModelConpublic Statement createStatement(Resource r, Property p, String o)
ModelConSubsequent 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.
createStatement in interface ModelConr - the subject of the statementp - the predicate of the statemento - is the value to be the object of the statementpublic Statement createLiteralStatement(Resource r, Property p, Object o)
ModelConcreateLiteralStatement in interface ModelConpublic Statement createStatement(Resource r, Property p, String o, boolean wellFormed)
ModelConSubsequent 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.
createStatement in interface ModelConr - 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 XMLpublic Statement createStatement(Resource r, Property p, String o, String l)
ModelConSubsequent 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.
createStatement in interface ModelConr - 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 objectpublic Statement createStatement(Resource r, Property p, String o, String l, boolean wellFormed)
ModelConSubsequent 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.
createStatement in interface ModelConr - 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 XMLpublic Bag createBag()
ModelConSubsequent 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.
public Alt createAlt()
ModelConSubsequent 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.
public Seq createSeq()
ModelConSubsequent 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.
public RDFList createList()
createList in interface Modelpublic RDFList createList(Iterator<? extends RDFNode> members)
Answer a new list containing the resources from the given iterator, in order.
createList in interface Modelmembers - An iterator, each value of which is expected to be an RDFNode.public RDFList createList(RDFNode... members)
Answer a new list containing the RDF nodes from the given array, in order
createList in interface Modelmembers - An array of RDFNodes that will be the members of the listpublic RDFNode getRDFNode(Node n)
ModelConResource or a Literal)
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.getRDFNode in interface ModelConn - the graph.Node on which to base the Model.RDFNodepublic Resource getResource(String uri)
ModelcreateResource(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.
getResource in interface Modeluri - the URI of the resourcepublic Property getProperty(String uri)
ModelConSubsequent operations on the returned property may modify this model.
The property is assumed to already exist in the model. If it does not,
createProperty should be used instead.
getProperty in interface ModelConuri - the URI of the propertypublic Property getProperty(String nameSpace, String localName)
ModelcreateProperty(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.
getProperty in interface ModelnameSpace - the RDF namespace of the propertylocalName - the localName of the property in its namespacepublic Seq getSeq(String uri)
ModelConSubsequent operations on the returned sequence may modify this model.
The seq is assumed to already exist in the model. If it does not,
createSeq should be used instead.
public Seq getSeq(Resource r)
ModelConThis 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,
createSeq should be used instead.
public Bag getBag(String uri)
ModelConSubsequent operations on the returned bag may modify this model.
The bag is assumed to already exist in the model. If it does not,
createBag should be used instead.
public Bag getBag(Resource r)
ModelConThis 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,
createBag should be used instead.
public RDFList getList(String uri)
ModelConSubsequent operations on the returned list may modify this model.
The list is assumed to already exist in the model. If it does not,
createList should be used instead.
public RDFList getList(Resource r)
ModelConThis 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,
createList should be used instead.
public Alt getAlt(String uri)
ModelConSubsequent operations on the returned object may modify this model.
The alt is assumed to already exist in the model. If it does not,
createAlt should be used instead.
public Alt getAlt(Resource r)
ModelConThis 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,
createAlt should be used instead.
public long size()
Modelpublic boolean isEmpty()
Modelpublic NsIterator listNameSpaces()
ModelThe 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.
listNameSpaces in interface ModelPrefixMappingpublic boolean samePrefixMappingAs(PrefixMapping other)
PrefixMappingthis.getNsPrefixMap().equals( other.getNsPrefixMap() )except that it may avoid unnecessary Map creations.
samePrefixMappingAs in interface PrefixMappingpublic PrefixMapping lock()
PrefixMappinglock in interface PrefixMappingpublic Model setNsPrefix(String prefix, String uri)
PrefixMappingA 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.
setNsPrefix in interface ModelsetNsPrefix in interface PrefixMappingprefix - the string to be used for the prefix.uri - the URI prefix to be namedpublic Model removeNsPrefix(String prefix)
PrefixMappingThe 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.
removeNsPrefix in interface ModelremoveNsPrefix in interface PrefixMappingprefix - the prefix string to removepublic Model clearNsPrefixMap()
PrefixMappingclearNsPrefixMap in interface ModelclearNsPrefixMap in interface PrefixMappingpublic Model setNsPrefixes(PrefixMapping pm)
PrefixMappingsetNsPrefixes in interface ModelsetNsPrefixes in interface PrefixMappingpm - the PrefixMapping to addpublic Model setNsPrefixes(Map<String,String> map)
PrefixMappingsetNsPrefixes in interface ModelsetNsPrefixes in interface PrefixMappingmap - the Map whose maplets are to be addedpublic Model withDefaultMappings(PrefixMapping other)
PrefixMappingmap, only
adding those (p, u) pairs for which neither p nor u appears in this mapping.
Answer this PrefixMapping.withDefaultMappings in interface ModelwithDefaultMappings in interface PrefixMappingpublic String getNsPrefixURI(String prefix)
PrefixMappinggetNsPrefixURI in interface PrefixMappingprefix - the prefix name to be looked uppublic String getNsURIPrefix(String uri)
PrefixMappinggetNsURIPrefix in interface PrefixMappinguri - the uri whose prefix is to be foundpublic Map<String,String> getNsPrefixMap()
PrefixMappinggetNsPrefixMap in interface PrefixMappingpublic String expandPrefix(String prefixed)
PrefixMappingexpandPrefix in interface PrefixMappingprefixed - a QName or URIpublic String qnameFor(String uri)
PrefixMappingqnameFor in interface PrefixMappingpublic String shortForm(String uri)
PrefixMappingThe 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.
shortForm in interface PrefixMappinguri - the URI string to try and prefix-compresspublic boolean hasNoMappings()
PrefixMappinghasNoMappings in interface PrefixMappingpublic int numPrefixes()
PrefixMappingnumPrefixes in interface PrefixMappingpublic static void addNamespaces(Model m, Map<String,Set<String>> ns)
m - Model who's namespace is to be updatedns - the namespace map to add to the Modelpublic StmtIterator listStatements()
ModelSubsequent operations on those statements may modify this model.
listStatements in interface Modelpublic Model add(Statement[] statements)
public Model add(List<Statement> statements)
public Model remove(Statement[] statements)
public Model remove(List<Statement> statements)
public Model add(Resource s, Property p, RDFNode o)
ModelConpublic RSIterator listReifiedStatements()
ModellistReifiedStatements in interface Modelpublic RSIterator listReifiedStatements(Statement st)
ModellistReifiedStatements in interface Modelpublic boolean isReified(Statement s)
Modelpublic Resource getAnyReifiedStatement(Statement s)
getAnyReifiedStatement in interface Models - for which a reification is soughtpublic void removeAllReifications(Statement s)
removeAllReifications in interface Models - the statement who's reifications are to be discardedpublic void removeReification(ReifiedStatement rs)
ModelremoveReification in interface Modelpublic ReifiedStatement createReifiedStatement(Statement s)
createReifiedStatement in interface Modelpublic ReifiedStatement createReifiedStatement(String uri, Statement s)
ModelcreateReifiedStatement in interface Modelpublic boolean contains(Statement s)
Modelpublic boolean containsResource(RDFNode r)
ModelcontainsResource in interface Modelr - the RDFNode to be searched forpublic boolean contains(Resource s, Property p)
Modelpublic boolean contains(Resource s, Property p, RDFNode o)
Modelcontains in interface Models - 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).public Statement getRequiredProperty(Resource s, Property p)
ModelIf 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.
getRequiredProperty in interface Models - The subject of the statement to be returned.p - The property of the statement to be returned.public Statement getRequiredProperty(Resource s, Property p, String lang)
ModelIf 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.
getRequiredProperty in interface Models - The subject of the statement to be returned.p - The property of the statement to be returned.lang - The languagepublic Statement getProperty(Resource s, Property p)
ModelgetProperty in interface Models - the subject of the statement to returnp - the predicate of the statement to returnpublic Statement getProperty(Resource s, Property p, String lang)
ModelgetProperty in interface Models - the subject of the statement to returnp - the predicate of the statement to returnlang - language of the objectpublic ResIterator listSubjects()
ModelSubsequent operations on those resource may modify this model.
listSubjects in interface Modelpublic ResIterator listResourcesWithProperty(Property p)
Modelp. remove()
is not implemented on this iterator.listResourcesWithProperty in interface Modelpublic ResIterator listSubjectsWithProperty(Property p)
ModellistResourcesWithProperty(Property),
retained for backward compatibility. It may be deprecated in later
releases.listSubjectsWithProperty in interface Modelpublic ResIterator listResourcesWithProperty(Property p, RDFNode o)
Modelp with value o.
remove() is not implemented on this iterator.listResourcesWithProperty in interface Modelpublic NodeIterator listObjects()
ModellistObjects in interface Modelpublic NodeIterator listObjectsOfProperty(Property p)
ModellistObjectsOfProperty in interface Modelp - The predicate soughtpublic NodeIterator listObjectsOfProperty(Resource s, Property p)
ModellistObjectsOfProperty in interface Modelp - The predicate soughtpublic StmtIterator listStatements(Selector selector)
ModelA statement is considered to match if the test method
of s returns true when called on s.
listStatements in interface Modelselector - A selector object.
.public ExtendedIterator<Triple> findTriplesFrom(Selector s)
s - a Selector used to supply subject, predicate, and objectpublic boolean supportsTransactions()
ModelsupportsTransactions in interface Modelpublic Model begin()
ModelAll changes made to a model within a transaction, will either be made, or none of them will be made.
public Model abort()
Modelpublic Model commit()
Modelpublic Object executeInTransaction(Command cmd)
ModelexecuteInTransaction in interface Modelpublic void executeInTxn(Runnable action)
Modelaction within a transaction. If it completes normally,
commit the transaction, otherwise abort the transaction.executeInTxn in interface Modelpublic <T> T calculateInTxn(Supplier<T> action)
action within a transaction. If it completes normally,
commit the transaction and return the result, otherwise abort the transaction.calculateInTxn in interface Modelpublic boolean independent()
ModelFor 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.
independent in interface Modelpublic Resource createResource()
ModelSubsequent operations on the returned resource may modify this model.
createResource in interface Modelpublic Resource createResource(String uri)
ModelcreateResource(). 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.
createResource in interface Modeluri - the URI of the resource to be createdpublic Property createProperty(String uri)
ModelConSubsequent operations on the returned property may modify this model.
createProperty in interface ModelConuri - the URI of the propertypublic Property createProperty(String nameSpace, String localName)
ModelThis 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.
createProperty in interface ModelnameSpace - the nameSpace of the propertylocalName - the name of the property within its namespacepublic Statement createStatement(Resource r, Property p, RDFNode o)
createStatement in interface Modelr - the subject of the statementp - the predicate of the statemento - the object of the statementpublic Bag createBag(String uri)
ModelConSubsequent 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.
public Alt createAlt(String uri)
ModelConSubsequent 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.
public Seq createSeq(String uri)
ModelConSubsequent 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.
public Statement asStatement(Triple t)
asStatement in interface ModelGraphInterfacet - a triple to wrap as a statementpublic StmtIterator asStatements(Iterator<Triple> it)
public StmtIterator listBySubject(Container cont)
public void close()
ModelNot 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.
public boolean isClosed()
Modelpublic boolean supportsSetOperations()
ModelsupportsSetOperations in interface Modelpublic Model query(Selector selector)
ModelA statement is considered to match if the test method
of s returns true when called on s.
public Model union(Model model)
ModelThe 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.
public Model intersection(Model other)
size() can be expensive on database and inference
models.intersection in interface Modelother - The other model.Model.intersection(org.apache.jena.rdf.model.Model)public static Model intersect(Model smaller, Model larger)
public Model difference(Model model)
Modeldifference in interface Modelmodel - the other model whose statements are to be excluded.public String reifiedToString()
public boolean isIsomorphicWith(Model m)
isIsomorphicWith in interface Modelm - Compare against this.public Lock getModelLock()
public Lock getLock()
Modelpublic void enterCriticalSection(boolean requestReadLock)
LockenterCriticalSection in interface LockrequestReadLock - true implies a read lock, false implies write lock.Lock.leaveCriticalSection()public void leaveCriticalSection()
LockleaveCriticalSection in interface LockLock.enterCriticalSection(boolean)public Model register(ModelChangedListener listener)
register in interface Modellistener - A ModelChangedListener to register for model eventsModelChangedListenerpublic Model unregister(ModelChangedListener listener)
unregister in interface Modellistener - A ModelChangedListener to unregister from model eventsModelChangedListenerpublic GraphListener adapt(ModelChangedListener L)
L.L - a model listener to be wrapped as a graph listenerModelListenerAdapterpublic Model notifyEvent(Object e)
ModelnotifyEvent in interface Modele - the event that has occurredLicenced under the Apache License, Version 2.0