Class UnionModel
- java.lang.Object
-
- org.apache.jena.enhanced.EnhGraph
-
- org.apache.jena.rdf.model.impl.ModelCom
-
- com.github.owlcs.ontapi.jena.impl.UnionModel
-
- All Implemented Interfaces:
org.apache.jena.rdf.model.Model
,org.apache.jena.rdf.model.ModelCon
,org.apache.jena.rdf.model.ModelGraphInterface
,org.apache.jena.rdf.model.RDFReaderF
,org.apache.jena.rdf.model.RDFWriterF
,org.apache.jena.shared.Lock
,org.apache.jena.shared.PrefixMapping
- Direct Known Subclasses:
OntGraphModelImpl
public class UnionModel extends org.apache.jena.rdf.model.impl.ModelCom
-
-
Constructor Summary
Constructors Constructor Description UnionModel(org.apache.jena.graph.Graph base, org.apache.jena.enhanced.Personality<org.apache.jena.rdf.model.RDFNode> personality)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static UnionGraph
asUnionGraph(org.apache.jena.graph.Graph graph)
Creates anUnionGraph
instance if it is needed.<N extends org.apache.jena.rdf.model.RDFNode>
NfetchNodeAs(org.apache.jena.graph.Node node, Class<N> type)
Answers an enhanced node that wraps the given node and conforms to the given interface type, taking into account possible graph recursions.<N extends org.apache.jena.rdf.model.RDFNode>
NfindNodeAs(org.apache.jena.graph.Node node, Class<N> type)
Returns aRDFNode
for the given type and, if the result is present, caches it node at the model level.org.apache.jena.graph.Graph
getBaseGraph()
org.apache.jena.rdf.model.Model
getBaseModel()
UnionGraph
getGraph()
<N extends org.apache.jena.rdf.model.RDFNode>
NgetNodeAs(org.apache.jena.graph.Node node, Class<N> type)
Answers an enhanced node that wraps the given node and conforms to the given interface type.protected <N extends org.apache.jena.rdf.model.RDFNode>
NgetNodeAsInternal(org.apache.jena.graph.Node node, Class<N> type)
Answers an enhanced node that wraps the given node and conforms to the given interface type.protected org.apache.jena.atlas.lib.Cache<org.apache.jena.graph.Node,org.apache.jena.rdf.model.RDFNode>
getNodeCache()
Returns nodes cache.boolean
isLocal(org.apache.jena.rdf.model.Resource s, org.apache.jena.rdf.model.Property p, org.apache.jena.rdf.model.RDFNode o)
Answerstrue
if the given SPO belongs to the base graph.boolean
isLocal(org.apache.jena.rdf.model.Statement s)
Answerstrue
if the given statement belongs to the base graph.String
toString()
UnionModel
write(OutputStream out)
UnionModel
write(OutputStream out, String lang)
UnionModel
write(OutputStream out, String lang, String base)
UnionModel
write(Writer writer)
UnionModel
write(Writer writer, String lang)
UnionModel
write(Writer writer, String lang, String base)
-
Methods inherited from class org.apache.jena.rdf.model.impl.ModelCom
abort, adapt, add, add, add, add, add, add, add, add, add, add, add, addCommon, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addNamespaces, asModel, asNode, asRDFNode, asStatement, asStatements, asStatements, asStatements, begin, calculateInTxn, clearNsPrefixMap, close, commit, contains, contains, contains, contains, contains, containsAll, containsAll, containsAllThenClose, containsAny, containsAny, containsAnyThenClose, containsLiteral, containsLiteral, containsLiteral, containsLiteral, containsLiteral, containsLiteral, containsLiteral, containsResource, createAlt, createAlt, createBag, createBag, createList, createList, createList, createLiteral, createLiteral, createLiteral, createLiteral, createLiteralStatement, createLiteralStatement, createLiteralStatement, createLiteralStatement, createLiteralStatement, createLiteralStatement, createLiteralStatement, createProperty, createProperty, createReifiedStatement, createReifiedStatement, createResource, createResource, createResource, createResource, createResource, createResource, createResource, createResource, createSeq, createSeq, createStatement, createStatement, createStatement, createStatement, createStatement, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createWorkModel, difference, enterCriticalSection, executeInTxn, expandPrefix, findTriplesFrom, getAlt, getAlt, getAnyReifiedStatement, getBag, getBag, getList, getList, getLock, getModelLock, getNsPrefixMap, getNsPrefixURI, getNsURIPrefix, getProperty, getProperty, getProperty, getProperty, getRDFNode, getReader, getReader, getRequiredProperty, getRequiredProperty, getResource, getResource, getSeq, getSeq, getWriter, getWriter, hasNoMappings, independent, intersect, intersection, isClosed, isEmpty, isIsomorphicWith, isReified, leaveCriticalSection, listBySubject, listLiteralStatements, listLiteralStatements, listLiteralStatements, listLiteralStatements, listLiteralStatements, listLiteralStatements, listNameSpaces, listObjects, listObjectsOfProperty, listObjectsOfProperty, listReifiedStatements, listReifiedStatements, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listStatements, listStatements, listStatements, listStatements, listStatements, listStatements, listSubjects, listSubjectsWithProperty, listSubjectsWithProperty, listSubjectsWithProperty, listSubjectsWithProperty, lock, notifyEvent, numPrefixes, qnameFor, query, read, read, read, read, read, read, read, register, reifiedToString, remove, remove, remove, remove, remove, remove, removeAll, removeAll, removeAllReifications, removeNsPrefix, removeReification, samePrefixMappingAs, setNsPrefix, setNsPrefixes, setNsPrefixes, shortForm, size, statementsToString, supportsSetOperations, supportsTransactions, union, unregister, withDefaultMappings, wrapAsResource
-
Methods inherited from class org.apache.jena.enhanced.EnhGraph
asGraph, equals, getPersonality, hashCode, isIsomorphicWith, setNodeCache
-
-
-
-
Method Detail
-
asUnionGraph
public static UnionGraph asUnionGraph(org.apache.jena.graph.Graph graph)
Creates anUnionGraph
instance if it is needed.- Parameters:
graph
-Graph
to wrap or return as is- Returns:
UnionGraph
(fresh or given)
-
getGraph
public UnionGraph getGraph()
- Specified by:
getGraph
in interfaceorg.apache.jena.rdf.model.ModelGraphInterface
- Overrides:
getGraph
in classorg.apache.jena.rdf.model.impl.ModelCom
-
getBaseGraph
public org.apache.jena.graph.Graph getBaseGraph()
-
getBaseModel
public org.apache.jena.rdf.model.Model getBaseModel()
-
write
public UnionModel write(Writer writer)
- Specified by:
write
in interfaceorg.apache.jena.rdf.model.Model
- Overrides:
write
in classorg.apache.jena.rdf.model.impl.ModelCom
-
write
public UnionModel write(Writer writer, String lang)
- Specified by:
write
in interfaceorg.apache.jena.rdf.model.Model
- Overrides:
write
in classorg.apache.jena.rdf.model.impl.ModelCom
-
write
public UnionModel write(Writer writer, String lang, String base)
- Specified by:
write
in interfaceorg.apache.jena.rdf.model.Model
- Overrides:
write
in classorg.apache.jena.rdf.model.impl.ModelCom
-
write
public UnionModel write(OutputStream out)
- Specified by:
write
in interfaceorg.apache.jena.rdf.model.Model
- Overrides:
write
in classorg.apache.jena.rdf.model.impl.ModelCom
-
write
public UnionModel write(OutputStream out, String lang)
- Specified by:
write
in interfaceorg.apache.jena.rdf.model.Model
- Overrides:
write
in classorg.apache.jena.rdf.model.impl.ModelCom
-
write
public UnionModel write(OutputStream out, String lang, String base)
- Specified by:
write
in interfaceorg.apache.jena.rdf.model.Model
- Overrides:
write
in classorg.apache.jena.rdf.model.impl.ModelCom
-
getNodeCache
protected org.apache.jena.atlas.lib.Cache<org.apache.jena.graph.Node,org.apache.jena.rdf.model.RDFNode> getNodeCache()
Returns nodes cache.- Returns:
Cache
withNode
as key andRDFNode
as value
-
isLocal
public boolean isLocal(org.apache.jena.rdf.model.Statement s)
Answerstrue
if the given statement belongs to the base graph.- Parameters:
s
-Statement
, notnull
- Returns:
- boolean
-
isLocal
public boolean isLocal(org.apache.jena.rdf.model.Resource s, org.apache.jena.rdf.model.Property p, org.apache.jena.rdf.model.RDFNode o)
Answerstrue
if the given SPO belongs to the base graph.- Parameters:
s
-Resource
, notnull
p
-Property
, notnull
o
-RDFNode
, notnull
- Returns:
- boolean
-
findNodeAs
public <N extends org.apache.jena.rdf.model.RDFNode> N findNodeAs(org.apache.jena.graph.Node node, Class<N> type)
Returns aRDFNode
for the given type and, if the result is present, caches it node at the model level. The method works silently: normally no exception is expected.- Type Parameters:
N
- any subtype ofRDFNode
- Parameters:
node
-Node
type
-Class
-type- Returns:
RDFNode
ornull
- Throws:
RuntimeException
- unexpected misconfiguration (RDF recursion, wrong input, personality mismatch, etc)- See Also:
getNodeAs(Node, Class)
-
getNodeAs
public <N extends org.apache.jena.rdf.model.RDFNode> N getNodeAs(org.apache.jena.graph.Node node, Class<N> type)
Answers an enhanced node that wraps the given node and conforms to the given interface type. The returned RDF node is cached at the model-level.- Overrides:
getNodeAs
in classorg.apache.jena.enhanced.EnhGraph
- Type Parameters:
N
- a subtype ofRDFNode
- Parameters:
node
- a node (assumed to be in this graph)type
- a type denoting the enhanced facet desired- Returns:
- an enhanced node, cannot be
null
- Throws:
OntJenaException
- unable to construct new RDF view for whatever reasonsRuntimeException
- unexpected misconfiguration (wrong inputs, personality mismatch)
-
fetchNodeAs
public <N extends org.apache.jena.rdf.model.RDFNode> N fetchNodeAs(org.apache.jena.graph.Node node, Class<N> type)
Answers an enhanced node that wraps the given node and conforms to the given interface type, taking into account possible graph recursions. For internal usage only.- Type Parameters:
N
- a subtype ofRDFNode
- Parameters:
node
- a node (assumed to be in this graph)type
- a type denoting the enhanced facet desired- Returns:
- an enhanced node or
null
if no match found - Throws:
OntJenaException.Recursion
- if a graph recursion is indicatedRuntimeException
- unexpected misconfiguration- See Also:
getNodeAs(Node, Class)
-
getNodeAsInternal
protected <N extends org.apache.jena.rdf.model.RDFNode> N getNodeAsInternal(org.apache.jena.graph.Node node, Class<N> type)
Answers an enhanced node that wraps the given node and conforms to the given interface type. The returned RDF node is cached at the model-level.- Type Parameters:
N
- a subtype ofRDFNode
- Parameters:
node
- a node (assumed to be in this graph)type
- a type denoting the enhanced facet desired- Returns:
- an enhanced node
- Throws:
org.apache.jena.enhanced.PersonalityConfigException
- if personality is misconfigured or the giventype
is absent in it; normally this should not happenNullPointerException
- if any input isnull
org.apache.jena.shared.JenaException
- unable to construct a new RDF view
-
toString
public String toString()
- Overrides:
toString
in classorg.apache.jena.rdf.model.impl.ModelCom
-
-