public class CoreGraph extends Object implements Graph
| Modifier and Type | Class and Description | 
|---|---|
protected static class  | 
CoreGraph.NodeAsString
Only one of those is filled. 
 | 
protected class  | 
CoreGraph.ResourceFinder  | 
protected class  | 
CoreGraph.SizeFinder  | 
protected class  | 
CoreGraph.StatementAdder  | 
protected class  | 
CoreGraph.StatementFinder  | 
protected class  | 
CoreGraph.StatementRemover  | 
static class  | 
CoreGraph.Subjects
Fake Node type used to pass down multiple nodes into whereBuilder. 
 | 
| Modifier and Type | Field and Description | 
|---|---|
protected static Statement | 
ALL  | 
static String | 
BLANK_NS  | 
static String | 
COMMENT_NAMESPACE
Has no final slash (compat). 
 | 
static String | 
DC_CREATED  | 
static String | 
DC_CREATOR  | 
static String | 
DC_DESCRIPTION  | 
static String | 
DC_MODIFIED  | 
static String | 
DC_TITLE  | 
static String[] | 
DOC_NAMESPACES  | 
protected String | 
docType  | 
static String | 
DOCUMENT_NAMESPACE  | 
static String | 
DOCUMENT_NAMESPACE2
Without final slash (compat). 
 | 
protected static List<Statement> | 
EMPTY_STATEMENTS  | 
protected String | 
name  | 
List<String> | 
namespaceList  | 
Map<String,String> | 
namespaces  | 
static String | 
OPTION_DOCTYPE  | 
static String | 
REL_PREDICATE  | 
static String | 
REL_SOURCE_ID  | 
static String | 
REL_SOURCE_URI  | 
static String | 
REL_TARGET_ID  | 
static String | 
REL_TARGET_STRING  | 
static String | 
REL_TARGET_URI  | 
static String | 
REL_TYPE  | 
protected CoreSession | 
session  | 
static Pattern | 
SPARQL_PO_S  | 
static Pattern | 
SPARQL_S_PO  | 
static Pattern | 
SPARQL_SPO_PO  | 
| Constructor and Description | 
|---|
CoreGraph(CoreSession session)
A graph with this base session. 
 | 
| 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. 
 | 
protected static String | 
getAuthor(Statement statement)  | 
protected static String | 
getComment(Statement statement)  | 
protected static Date | 
getCreationDate(Statement statement)  | 
protected static Date | 
getDateProperty(Statement statement,
               Resource prop)  | 
protected static String | 
getDefaultRepositoryName()  | 
protected static Date | 
getModificationDate(Statement statement)  | 
Map<String,String> | 
getNamespaces()
Returns namespaces for the graph. 
 | 
protected static CoreGraph.NodeAsString | 
getNodeAsString(Node node)  | 
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. 
 | 
protected static String | 
getStringProperty(Statement statement,
                 Resource prop)  | 
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. 
 | 
protected static String | 
localNameToId(String localName)  | 
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. 
 | 
protected static void | 
setAuthor(Statement statement,
         String author)  | 
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)  | 
Long | 
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 | 
write(String path,
     String lang,
     String base)
Serializes graph. 
 | 
public static final String OPTION_DOCTYPE
public static final String REL_TYPE
public static final String REL_PREDICATE
public static final String REL_SOURCE_ID
public static final String REL_SOURCE_URI
public static final String REL_TARGET_ID
public static final String REL_TARGET_URI
public static final String REL_TARGET_STRING
public static final String DC_CREATED
public static final String DC_CREATOR
public static final String DC_MODIFIED
public static final String DC_TITLE
public static final String DC_DESCRIPTION
public static final String BLANK_NS
public static final String DOCUMENT_NAMESPACE
public static final String DOCUMENT_NAMESPACE2
public static final String COMMENT_NAMESPACE
public static final String[] DOC_NAMESPACES
protected static final List<Statement> EMPTY_STATEMENTS
protected CoreSession session
public Map<String,String> namespaces
public List<String> namespaceList
public static final Pattern SPARQL_SPO_PO
public static final Pattern SPARQL_PO_S
public static final Pattern SPARQL_S_PO
public CoreGraph(CoreSession session)
public void setDescription(GraphDescription graphDescription)
GraphsetDescription in interface Graphprotected void setOptions(Map<String,String> options)
public Map<String,String> getNamespaces()
GraphNamespaces are prefix/namespace bindings, as rdf for http://www.w3.org/1999/02/22-rdf-syntax-ns#.
getNamespaces in interface Graphpublic Long size()
Graphpublic void clear()
Graphpublic void add(Statement statement)
Graphpublic void add(List<Statement> statements)
Graphpublic void remove(Statement statement)
Graphpublic void remove(List<Statement> statements)
Graphpublic List<Statement> getStatements()
GraphgetStatements in interface Graphpublic List<Statement> getStatements(Node subject, Node predicate, Node object)
GraphgetStatements in interface Graphpublic List<Statement> getStatements(Statement statement)
GraphgetStatements in interface Graphstatement - pattern to match, can hold null nodes as wildcardspublic List<Node> getSubjects(Node predicate, Node object)
GraphgetSubjects in interface Graphpredicate - predicate pattern, null acceptedobject - object pattern, null acceptedpublic List<Node> getPredicates(Node subject, Node object)
GraphgetPredicates in interface Graphsubject - subject pattern, null acceptedobject - object pattern, null acceptedpublic List<Node> getObjects(Node subject, Node predicate)
GraphgetObjects in interface Graphsubject - subject pattern, null acceptedpredicate - predicate pattern, null acceptedpublic boolean hasStatement(Statement statement)
GraphhasStatement in interface Graphstatement - statement pattern, can use null as wild cardspublic boolean hasResource(Resource resource)
GraphhasResource in interface Graphpublic QueryResult query(String queryString, String language, String baseURI)
Graphpublic int queryCount(String queryString, String language, String baseURI)
GraphqueryCount in interface GraphqueryString - the query stringlanguage - the query language (sparql, rdql,...)baseURI - the base URI to use for querypublic boolean read(String path, String lang, String base)
Graphread in interface Graphpath - 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.public boolean write(String path, String lang, String base)
Graphwrite in interface Graphpath - 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.public boolean read(InputStream in, String lang, String base)
Graphread in interface Graphin - 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.public boolean write(OutputStream out, String lang, String base)
Graphwrite in interface Graphout - 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.protected static String getDefaultRepositoryName()
protected String whereBuilder(String query, Statement statement)
protected static CoreGraph.NodeAsString getNodeAsString(Node node)
protected static String localNameToId(String localName)
protected static Date getCreationDate(Statement statement)
protected static void setCreationDate(Statement statement, Calendar created)
protected static Date getModificationDate(Statement statement)
protected static void setModificationDate(Statement statement, Calendar modified)
protected static String getComment(Statement statement)
protected static void setComment(Statement statement, String comment)
protected static String getStringProperty(Statement statement, Resource prop)
protected static void setStringProperty(Statement statement, Resource prop, String string)
protected static Date getDateProperty(Statement statement, Resource prop)
protected static void setDateProperty(Statement statement, Resource prop, Calendar date)
Copyright © 2019 Nuxeo. All rights reserved.