org.openanzo.model.impl
Class BasicGraph

java.lang.Object
  extended by org.openanzo.model.impl.BasicGraph
All Implemented Interfaces:
INamedGraph
Direct Known Subclasses:
NamedGraph

public class BasicGraph
extends java.lang.Object
implements INamedGraph

BasicGraph is the basic in-memory implementation of an INamedGraph which relies on a triple store to hold data in memory.

Author:
Matthew Roy ( mroy@cambridgesemantics.com )

Constructor Summary
BasicGraph(java.util.Collection<org.openrdf.model.Statement> statements, org.openrdf.model.URI namedGraphURI)
          Create a new BasicGraph with given URI, and prepopulated with set of statements
BasicGraph(org.openrdf.model.URI namedGraphURI)
          Create a new BasicGraph with given URI
 
Method Summary
 void add(info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> statements)
          Add a set of statements from graph
 void add(org.openrdf.model.Resource subj, org.openrdf.model.URI pred, org.openrdf.model.Value obj)
          Add a new statement with given subj,pred,obj
 void add(org.openrdf.model.Statement... statements)
          Add one or more statements to graph
 void clear()
          Delete all statements in graph
 void close()
          Close BasicGraph, will clear all data within graph to free memory.
 boolean contains(org.openrdf.model.Resource subj, org.openrdf.model.URI prop, org.openrdf.model.Value obj)
          Return true if the graph contains at least 1 statement that matches the pattern of subj,prop,obj
 boolean contains(org.openrdf.model.Statement stmt)
          Return true if the graph contains at least 1 statement that matches the statement provided
 void delete(info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> statements)
          Delete a set of statements from graph
 void delete(org.openrdf.model.Resource subj, org.openrdf.model.URI pred, org.openrdf.model.Value obj)
          Delete a statement from graph
 void delete(org.openrdf.model.Statement... statements)
          Delete a set of statements from graph
 info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> find(org.openrdf.model.Resource subj, org.openrdf.model.URI prop, org.openrdf.model.Value obj)
          Return an iterator of all statements that match the pattern of subj,prop,obj
 INamedGraphEventManager getEventManager()
          Return INamedGraphEventManager for this graph
 org.openrdf.model.URI getNamedGraphUri()
          Get NamedGraph's URI
 info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> getStatements()
          Get an iterator of all statements within this graph
 ITransactionManager getTransactionManager()
          Return ITransactionManager for this graph
 boolean isClosed()
          Return if graph is closed
 boolean isEmpty()
          Return if graph is empty
 void setNamedGraphUri(org.openrdf.model.URI namedGraphUri)
          Set NamedGraph's URI
 int size()
          Return number of statements in graph
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicGraph

public BasicGraph(org.openrdf.model.URI namedGraphURI)
Create a new BasicGraph with given URI

Parameters:
namedGraphURI - URI of this graph

BasicGraph

public BasicGraph(java.util.Collection<org.openrdf.model.Statement> statements,
                  org.openrdf.model.URI namedGraphURI)
Create a new BasicGraph with given URI, and prepopulated with set of statements

Parameters:
statements - statements to prepopulate graph with
namedGraphURI - URI of this graph
Method Detail

add

public void add(org.openrdf.model.Resource subj,
                org.openrdf.model.URI pred,
                org.openrdf.model.Value obj)
Description copied from interface: INamedGraph
Add a new statement with given subj,pred,obj

Specified by:
add in interface INamedGraph
Parameters:
subj - Subject of statement
pred - Predicate of statement
obj - Object of statement

delete

public void delete(org.openrdf.model.Resource subj,
                   org.openrdf.model.URI pred,
                   org.openrdf.model.Value obj)
Description copied from interface: INamedGraph
Delete a statement from graph

Specified by:
delete in interface INamedGraph
Parameters:
subj - Subject of statement
pred - Predicate of statement
obj - Object of statement

add

public void add(org.openrdf.model.Statement... statements)
Description copied from interface: INamedGraph
Add one or more statements to graph

Specified by:
add in interface INamedGraph
Parameters:
statements - statements to add to graph

delete

public void delete(org.openrdf.model.Statement... statements)
Description copied from interface: INamedGraph
Delete a set of statements from graph

Specified by:
delete in interface INamedGraph
Parameters:
statements - statements to delete from graph

add

public void add(info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> statements)
Description copied from interface: INamedGraph
Add a set of statements from graph

Specified by:
add in interface INamedGraph
Parameters:
statements - statements to delete from graph

delete

public void delete(info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> statements)
Description copied from interface: INamedGraph
Delete a set of statements from graph

Specified by:
delete in interface INamedGraph
Parameters:
statements - statements to delete from graph

getStatements

public info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> getStatements()
Description copied from interface: INamedGraph
Get an iterator of all statements within this graph

Specified by:
getStatements in interface INamedGraph
Returns:
CloseableIterator of all statements within this graph

find

public info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> find(org.openrdf.model.Resource subj,
                                                                                            org.openrdf.model.URI prop,
                                                                                            org.openrdf.model.Value obj)
Description copied from interface: INamedGraph
Return an iterator of all statements that match the pattern of subj,prop,obj

Specified by:
find in interface INamedGraph
Parameters:
subj - Subject resource to match, or wildcard if null
prop - Predicate uri to match, or wildcard if null
obj - Object value to match, or wildcard if null
Returns:
an iterator of all statements that match the pattern of subj,prop,obj

contains

public boolean contains(org.openrdf.model.Statement stmt)
Description copied from interface: INamedGraph
Return true if the graph contains at least 1 statement that matches the statement provided

Specified by:
contains in interface INamedGraph
Parameters:
stmt - Statement to check for existence in graph
Returns:
true if the graph contains at least 1 statement that matches the statement provided

contains

public boolean contains(org.openrdf.model.Resource subj,
                        org.openrdf.model.URI prop,
                        org.openrdf.model.Value obj)
Description copied from interface: INamedGraph
Return true if the graph contains at least 1 statement that matches the pattern of subj,prop,obj

Specified by:
contains in interface INamedGraph
Parameters:
subj - Subject resource to match, or wildcard if null
prop - Predicate uri to match, or wildcard if null
obj - Object value to match, or wildcard if null
Returns:
true if the graph contains at least 1 statement that matches the pattern of subj,prop,obj

close

public void close()
Close BasicGraph, will clear all data within graph to free memory.

Specified by:
close in interface INamedGraph

getNamedGraphUri

public org.openrdf.model.URI getNamedGraphUri()
Description copied from interface: INamedGraph
Get NamedGraph's URI

Specified by:
getNamedGraphUri in interface INamedGraph
Returns:
URI for this grpah

setNamedGraphUri

public void setNamedGraphUri(org.openrdf.model.URI namedGraphUri)
Description copied from interface: INamedGraph
Set NamedGraph's URI

Specified by:
setNamedGraphUri in interface INamedGraph

clear

public void clear()
Description copied from interface: INamedGraph
Delete all statements in graph

Specified by:
clear in interface INamedGraph

size

public int size()
Description copied from interface: INamedGraph
Return number of statements in graph

Specified by:
size in interface INamedGraph
Returns:
number of statements in graph

isEmpty

public boolean isEmpty()
Description copied from interface: INamedGraph
Return if graph is empty

Specified by:
isEmpty in interface INamedGraph
Returns:
true if graph is empty

isClosed

public boolean isClosed()
Description copied from interface: INamedGraph
Return if graph is closed

Specified by:
isClosed in interface INamedGraph
Returns:
true if graph is closed

getEventManager

public INamedGraphEventManager getEventManager()
Description copied from interface: INamedGraph
Return INamedGraphEventManager for this graph

Specified by:
getEventManager in interface INamedGraph
Returns:
INamedGraphEventManager for this graph

getTransactionManager

public ITransactionManager getTransactionManager()
Description copied from interface: INamedGraph
Return ITransactionManager for this graph

Specified by:
getTransactionManager in interface INamedGraph
Returns:
ITransactionManager for this graph


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.