public interface Graph extends Serializable
New types of graphs will be registered using extension points.
Graphs have to be serializable has they will be kept as references in the RelationService bean.
Modifier and Type | Method and Description |
---|---|
void |
add(List<Statement> statements)
Adds given list of Statement objects to the graph.
|
void |
add(Statement statement)
Adds the statement object to the graph.
|
void |
clear()
Clears the graph, removing all statements in it.
|
Map<String,String> |
getNamespaces()
Returns namespaces for the graph.
|
List<Node> |
getObjects(Node subject,
Node predicate)
Gets items matching the statement pattern (subject, predicate, null).
|
List<Node> |
getPredicates(Node subject,
Node object)
Gets items matching the statement pattern (subject, null, object).
|
List<Statement> |
getStatements()
Returns all statements in the graph.
|
List<Statement> |
getStatements(Node subject,
Node predicate,
Node object)
Returns all statements in the graph matching the pattern.
|
List<Statement> |
getStatements(Statement statement)
Returns all statements in the graph matching the pattern.
|
List<Node> |
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.
|
QueryResult |
query(String queryString,
String language,
String baseURI)
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 |
read(String path,
String lang,
String base)
Parses source into the graph.
|
void |
remove(List<Statement> statements)
Removes given list of Statement objects from the graph.
|
void |
remove(Statement statement)
Removes the statement object from the graph.
|
void |
setDescription(GraphDescription graphDescription)
Sets the graph description.
|
Long |
size()
Returns the number of statements in the graph.
|
boolean |
write(OutputStream out,
String lang,
String base)
Serializes graph.
|
boolean |
write(String path,
String lang,
String base)
Serializes graph.
|
void setDescription(GraphDescription graphDescription)
graphDescription
- Map<String,String> getNamespaces()
Namespaces are prefix/namespace bindings, as rdf for http://www.w3.org/1999/02/22-rdf-syntax-ns#.
void add(Statement statement)
statement
- statement to addvoid add(List<Statement> statements)
statements
- list of Statement instances to addvoid remove(Statement statement)
statement
- statement to removevoid remove(List<Statement> statements)
statements
- List of Statement instances to removeList<Statement> getStatements()
List<Statement> getStatements(Statement statement)
statement
- pattern to match, can hold null nodes as wildcardsList<Statement> getStatements(Node subject, Node predicate, Node object)
statement
- pattern to match, can hold null nodes as wildcardsList<Node> getSubjects(Node predicate, Node object)
predicate
- predicate pattern, null acceptedobject
- object pattern, null acceptedList<Node> getPredicates(Node subject, Node object)
subject
- subject pattern, null acceptedobject
- object pattern, null acceptedList<Node> getObjects(Node subject, Node predicate)
subject
- subject pattern, null acceptedpredicate
- predicate pattern, null acceptedboolean hasStatement(Statement statement)
statement
- statement pattern, can use null as wild cardsboolean hasResource(Resource resource)
resource
- Long size()
void clear()
QueryResult query(String queryString, String language, String baseURI)
queryString
- the query stringlanguage
- the query language (sparql, rdql,...)baseURI
- the base URI to use for queryint queryCount(String queryString, String language, String baseURI)
queryString
- the query stringlanguage
- the query language (sparql, rdql,...)baseURI
- the base URI to use for queryboolean read(String path, String lang, String base)
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.boolean read(InputStream in, String lang, String base)
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.boolean write(String path, String lang, String base)
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.boolean write(OutputStream out, String lang, String base)
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.Copyright © 2018 Nuxeo. All rights reserved.