Package org.nuxeo.ecm.platform.relations
Class CoreGraph
java.lang.Object
org.nuxeo.ecm.platform.relations.CoreGraph
- All Implemented Interfaces:
Serializable
,Graph
Relation graph implementation delegating to the core.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Only one of those is filled.protected class
protected class
protected class
protected class
protected class
static class
Fake Node type used to pass down multiple nodes into whereBuilder. -
Field Summary
Modifier and TypeFieldDescriptionprotected static final Statement
static final String
static final String
Has no final slash (compat).static final String
static final String
static final String
static final String
static final String
static final String[]
protected String
static final String
static final String
Without final slash (compat).protected String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
protected CoreSession
static final Pattern
static final Pattern
static final Pattern
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds given list of Statement objects to the graph.void
Adds the statement object to the graph.void
clear()
Clears the graph, removing all statements in it.protected static String
protected static String
getComment
(Statement statement) protected static Date
getCreationDate
(Statement statement) protected static Date
getDateProperty
(Statement statement, Resource prop) protected static String
protected static Date
getModificationDate
(Statement statement) Returns namespaces for the graph.protected static CoreGraph.NodeAsString
getNodeAsString
(Node node) getObjects
(Node subject, Node predicate) Gets items matching the statement pattern (subject, predicate, null).getPredicates
(Node subject, Node object) Gets items matching the statement pattern (subject, null, object).Returns all statements in the graph.getStatements
(Node subject, Node predicate, Node object) Returns all statements in the graph matching the pattern.getStatements
(Statement statement) Returns all statements in the graph matching the pattern.protected static String
getStringProperty
(Statement statement, Resource prop) getSubjects
(Node predicate, Node object) Get items matching the statement pattern (null, predicate, object).boolean
hasResource
(Resource resource) Returns true if given resource appears in any statement of the graph.boolean
hasStatement
(Statement statement) Returns true if given statement pattern is in the graph.protected static String
localNameToId
(String localName) Query the graph using a base URI.int
queryCount
(String queryString, String language, String baseURI) Counts the number of results of a query.boolean
read
(InputStream in, String lang, String base) Parses source into the graph.boolean
Parses source into the graph.void
Removes given list of Statement objects from the graph.void
Removes the statement object from the graph.protected static void
protected static void
setComment
(Statement statement, String comment) protected static void
setCreationDate
(Statement statement, Calendar created) protected static void
setDateProperty
(Statement statement, Resource prop, Calendar date) void
setDescription
(GraphDescription graphDescription) Sets the graph description.protected static void
setModificationDate
(Statement statement, Calendar modified) protected void
setOptions
(Map<String, String> options) protected static void
setStringProperty
(Statement statement, Resource prop, String string) size()
Returns the number of statements in the graph.protected String
whereBuilder
(String query, Statement statement) boolean
write
(OutputStream out, String lang, String base) Serializes graph.boolean
Serializes graph.
-
Field Details
-
OPTION_DOCTYPE
- See Also:
-
REL_TYPE
- See Also:
-
REL_PREDICATE
- See Also:
-
REL_SOURCE_ID
- See Also:
-
REL_SOURCE_URI
- See Also:
-
REL_TARGET_ID
- See Also:
-
REL_TARGET_URI
- See Also:
-
REL_TARGET_STRING
- See Also:
-
DC_CREATED
- See Also:
-
DC_CREATOR
- See Also:
-
DC_MODIFIED
- See Also:
-
DC_TITLE
- See Also:
-
DC_DESCRIPTION
- See Also:
-
BLANK_NS
- See Also:
-
DOCUMENT_NAMESPACE
- See Also:
-
DOCUMENT_NAMESPACE2
Without final slash (compat). -
COMMENT_NAMESPACE
Has no final slash (compat).- See Also:
-
DOC_NAMESPACES
-
EMPTY_STATEMENTS
-
ALL
-
session
-
name
-
docType
-
namespaces
-
namespaceList
-
SPARQL_SPO_PO
-
SPARQL_PO_S
-
SPARQL_S_PO
-
-
Constructor Details
-
CoreGraph
A graph with this base session. An unrestricted session will be opened based on it.
-
-
Method Details
-
setDescription
Description copied from interface:Graph
Sets the graph description.- Specified by:
setDescription
in interfaceGraph
-
setOptions
-
getNamespaces
Description copied from interface:Graph
Returns namespaces for the graph.Namespaces are prefix/namespace bindings, as rdf for http://www.w3.org/1999/02/22-rdf-syntax-ns#.
- Specified by:
getNamespaces
in interfaceGraph
- Returns:
- namespaces map of namespace bindings for the graph
-
size
Description copied from interface:Graph
Returns the number of statements in the graph. -
clear
public void clear()Description copied from interface:Graph
Clears the graph, removing all statements in it. -
add
Description copied from interface:Graph
Adds the statement object to the graph. -
add
Description copied from interface:Graph
Adds given list of Statement objects to the graph. -
remove
Description copied from interface:Graph
Removes the statement object from the graph. -
remove
Description copied from interface:Graph
Removes given list of Statement objects from the graph. -
getStatements
Description copied from interface:Graph
Returns all statements in the graph.- Specified by:
getStatements
in interfaceGraph
- Returns:
- list of Statement instances
-
getStatements
Description copied from interface:Graph
Returns all statements in the graph matching the pattern.- Specified by:
getStatements
in interfaceGraph
- Returns:
- list of Statement instances matching the pattern
-
getStatements
Description copied from interface:Graph
Returns all statements in the graph matching the pattern.- Specified by:
getStatements
in interfaceGraph
- Parameters:
statement
- pattern to match, can hold null nodes as wildcards- Returns:
- list of Statement instances matching the pattern
-
getSubjects
Description copied from interface:Graph
Get items matching the statement pattern (null, predicate, object).- Specified by:
getSubjects
in interfaceGraph
- Parameters:
predicate
- predicate pattern, null acceptedobject
- object pattern, null accepted- Returns:
- list of subjects
-
getPredicates
Description copied from interface:Graph
Gets items matching the statement pattern (subject, null, object).- Specified by:
getPredicates
in interfaceGraph
- Parameters:
subject
- subject pattern, null acceptedobject
- object pattern, null accepted- Returns:
- list of predicates
-
getObjects
Description copied from interface:Graph
Gets items matching the statement pattern (subject, predicate, null).- Specified by:
getObjects
in interfaceGraph
- Parameters:
subject
- subject pattern, null acceptedpredicate
- predicate pattern, null accepted- Returns:
- list of node objects
-
hasStatement
Description copied from interface:Graph
Returns true if given statement pattern is in the graph.- Specified by:
hasStatement
in interfaceGraph
- Parameters:
statement
- statement pattern, can use null as wild cards- Returns:
- true or false
-
hasResource
Description copied from interface:Graph
Returns true if given resource appears in any statement of the graph.- Specified by:
hasResource
in interfaceGraph
- Returns:
- true or false
-
query
Description copied from interface:Graph
Query the graph using a base URI. -
queryCount
Description copied from interface:Graph
Counts the number of results of a query.- Specified by:
queryCount
in interfaceGraph
- Parameters:
queryString
- the query stringlanguage
- the query language (sparql, rdql,...)baseURI
- the base URI to use for query- Returns:
- the count
-
read
Description copied from interface:Graph
Parses source into the graph.- Specified by:
read
in interfaceGraph
- Parameters:
path
- path on file system where to take the serialization filelang
- format for the input serialization, may be "RDF/XML", "RDF/XML-ABBREV", "N-TRIPLE" and "N3". The default value, represented by null, is "RDF/XML".base
- base uri to be used when converting relative uris to absolute uris, may be null. If set to "", allows relative uris to be used in the model.- Returns:
- true on success, else false
-
write
Description copied from interface:Graph
Serializes graph.- Specified by:
write
in interfaceGraph
- Parameters:
path
- path on file system where to put the serialization filelang
- format for the input serialization, may be "RDF/XML", "RDF/XML-ABBREV", "N-TRIPLE" and "N3". The default value, represented by null, is "RDF/XML".base
- base uri to be used when converting relative uris to absolute uris, may be null. If set to "", allows relative uris to be used in the model.- Returns:
- true on success, else false
-
read
Description copied from interface:Graph
Parses source into the graph.- Specified by:
read
in interfaceGraph
- Parameters:
in
- input streamlang
- format for the input serialization, may be "RDF/XML", "RDF/XML-ABBREV", "N-TRIPLE" and "N3". The default value, represented by null, is "RDF/XML".base
- base uri to be used when converting relative uris to absolute uris, may be null. If set to "", allows relative uris to be used in the model.- Returns:
- true on success, else false
-
write
Description copied from interface:Graph
Serializes graph.- Specified by:
write
in interfaceGraph
- Parameters:
out
- output streamlang
- format for the input serialization, may be "RDF/XML", "RDF/XML-ABBREV", "N-TRIPLE" and "N3". The default value, represented by null, is "RDF/XML".base
- base uri to be used when converting relative uris to absolute uris, may be null. If set to "", allows relative uris to be used in the model.- Returns:
- true on success, else false
-
getDefaultRepositoryName
-
whereBuilder
-
getNodeAsString
-
localNameToId
-
getAuthor
-
setAuthor
-
getCreationDate
-
setCreationDate
-
getModificationDate
-
setModificationDate
-
getComment
-
setComment
-
getStringProperty
-
setStringProperty
-
getDateProperty
-
setDateProperty
-