org.openanzo.server.repository.structures
Class NamedGraph

java.lang.Object
  extended by org.openanzo.server.repository.structures.NamedGraph
All Implemented Interfaces:
Batchable, CachableResource

public class NamedGraph
extends java.lang.Object
implements Batchable, CachableResource

Provides read and write access to NamedGraph stored in the repository. NamedGraph are named arbitrary groupings of statements that may overlap and subsume each other. NamedGraph data is cached in memory and is not persisted to the repository until commit is called or a batch commit (via the Batchable interface) is performed.

Author:
Joe Betz, Matthew Roy ( mroy@cambridgesemantics.com )
See Also:
Batchable

Nested Class Summary
static class NamedGraph.Factory
          Factory to create NamedGraph
 
Nested classes/interfaces inherited from interface org.openanzo.jdbc.utils.batchable.Batchable
Batchable.BatchGroup, Batchable.BatchOperation, Batchable.BatchOperationSet, Batchable.NullBatch
 
Field Summary
 
Fields inherited from interface org.openanzo.jdbc.utils.batchable.Batchable
EMPTY_BATCH
 
Method Summary
 void commit()
          Commit changes to the database
static NamedGraph createNamedGraph(java.lang.Long id, java.lang.Long metaId, java.lang.Long aclId, java.lang.Long timestamp, java.lang.Long createdBy, long revision, RepositoryConnection repositoryConnection, long lastModifiedBy)
          Create NamedGraph with given properties
 java.lang.Long getAclId()
          Get the aclid for this graph
 java.lang.Long getCreatedBy()
          Get id of user that created this NamedGraph
 java.lang.Long getId()
          Gets the id of the data object.
 java.lang.Long getLastModifiedBy()
          Get id of user that last modified this NamedGraph
 org.openrdf.model.URI getMetaDataUri()
          Get the URI of the metadata graph
 java.lang.Long getMetaId()
          Get the metadata id of namedGraph
 java.lang.Long getModified()
          Get timestamp when NamedGraph was last modified
 long getRevision()
          Get the revision of the graph
 org.openrdf.model.URI getURI()
          Get the URI for this graph
 boolean incrementRevision()
          Increment the revision of the graph if something changed during current transaction
 boolean isDirty()
          Has namedGraph changed during current transaction
 boolean isStored()
          Get if the namedgraph is stored in the database
static boolean isStored(RepositoryConnection repositoryConnection, java.lang.Long id)
          Is this NamedGraph stored in database
 java.util.List<Batchable.BatchOperation> listBatchOperations()
          Get the current list of batch operations for this object
static NamedGraph loadNamedGraph(java.lang.Long id, RepositoryConnection repositoryConnection)
          Load a NamedGraph from database
 void remove()
          Remove the namedgraph from the database
 void setAclId(java.lang.Long aclId)
          Set the aclid for the graph
 void setCreatedBy(java.lang.Long createdBy)
          Set id of user that created this NamedGraph
 void setLastModifiedBy(java.lang.Long lastModifiedBy)
          Set id of user that last modified this NamedGraph
 void setMetaId(java.lang.Long metaId)
          Set the metaid for the graph
 void setModified(java.lang.Long modified)
          Set the lastModified timestamp
 void setRevision(long revision)
          Set the revision for the graph
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isStored

public static boolean isStored(RepositoryConnection repositoryConnection,
                               java.lang.Long id)
                        throws AnzoException
Is this NamedGraph stored in database

Parameters:
repositoryConnection - connection to the database
id - id of the NamedGraph
Returns:
true if the NamedGraph is stored in the database
Throws:
AnzoException

loadNamedGraph

public static NamedGraph loadNamedGraph(java.lang.Long id,
                                        RepositoryConnection repositoryConnection)
                                 throws AnzoException
Load a NamedGraph from database

Parameters:
id - id of the NamedGraph
repositoryConnection - connection to the database
Returns:
a NamedGraph object for the provided ID
Throws:
AnzoException

createNamedGraph

public static NamedGraph createNamedGraph(java.lang.Long id,
                                          java.lang.Long metaId,
                                          java.lang.Long aclId,
                                          java.lang.Long timestamp,
                                          java.lang.Long createdBy,
                                          long revision,
                                          RepositoryConnection repositoryConnection,
                                          long lastModifiedBy)
                                   throws AnzoException
Create NamedGraph with given properties

Parameters:
id - ID of namedGraph
metaId - MetadataId of namedGraph
aclId - ACLid of namedGraph
timestamp - Timestamp when namedGraph was modified
createdBy - User that created namedGraph
revision - Revision of namedGraph
repositoryConnection - RepositoryConnection to write data to
lastModifiedBy -
Returns:
a NamedGraph object for the provided data
Throws:
AnzoException

getId

public java.lang.Long getId()
Description copied from interface: CachableResource
Gets the id of the data object. This must be available after the object is loaded, or if it has been created but not presisted, after allocateId() is called.

Specified by:
getId in interface CachableResource
Returns:
Id of the data object

getMetaId

public java.lang.Long getMetaId()
Get the metadata id of namedGraph

Returns:
the metadata id of namedGraph

getMetaDataUri

public org.openrdf.model.URI getMetaDataUri()
Get the URI of the metadata graph

Returns:
the URI of the metadata graph

getURI

public org.openrdf.model.URI getURI()
Get the URI for this graph

Specified by:
getURI in interface CachableResource
Returns:
URI of the data object

getAclId

public java.lang.Long getAclId()
Get the aclid for this graph

Returns:
the acl id for this graph

getRevision

public long getRevision()
Get the revision of the graph

Returns:
the revision of the graph

setAclId

public void setAclId(java.lang.Long aclId)
Set the aclid for the graph

Parameters:
aclId - the aclid for the graph

setMetaId

public void setMetaId(java.lang.Long metaId)
Set the metaid for the graph

Parameters:
metaId - the metaid for the graph

setRevision

public void setRevision(long revision)
Set the revision for the graph

Parameters:
revision - the revision for the graph

incrementRevision

public boolean incrementRevision()
Increment the revision of the graph if something changed during current transaction

Returns:
the revision of the graph if something changed during current transaction

setModified

public void setModified(java.lang.Long modified)
Set the lastModified timestamp

Parameters:
modified - the lastModified timestamp

isStored

public boolean isStored()
Get if the namedgraph is stored in the database

Specified by:
isStored in interface CachableResource
Returns:
true if the namedgraph is stored in the database

remove

public void remove()
Remove the namedgraph from the database


commit

public void commit()
            throws RdbException
Commit changes to the database

Throws:
RdbException

listBatchOperations

public java.util.List<Batchable.BatchOperation> listBatchOperations()
Description copied from interface: Batchable
Get the current list of batch operations for this object

Specified by:
listBatchOperations in interface Batchable
Returns:
the current list of batch operations for this object

isDirty

public boolean isDirty()
Has namedGraph changed during current transaction

Returns:
true if the namedGraph changed during current transaction

getCreatedBy

public java.lang.Long getCreatedBy()
Get id of user that created this NamedGraph

Returns:
the id of user that created this NamedGraph

setCreatedBy

public void setCreatedBy(java.lang.Long createdBy)
Set id of user that created this NamedGraph

Parameters:
createdBy - id of user that created this NamedGraph

getLastModifiedBy

public java.lang.Long getLastModifiedBy()
Get id of user that last modified this NamedGraph

Returns:
id of user that last modified this NamedGraph

setLastModifiedBy

public void setLastModifiedBy(java.lang.Long lastModifiedBy)
Set id of user that last modified this NamedGraph

Parameters:
lastModifiedBy - id of user that last modified this NamedGraph

getModified

public java.lang.Long getModified()
Get timestamp when NamedGraph was last modified

Returns:
timestamp when NamedGraph was last modified


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