org.openanzo.model.delta
Class DeltaGraphContainer

java.lang.Object
  extended by org.openanzo.model.delta.DeltaGraphContainer

public class DeltaGraphContainer
extends java.lang.Object

BasicGraph is the underlying implementation of a overlay of delta changes to a base graph

Author:
Matthew Roy ( mroy@cambridgesemantics.com )

Constructor Summary
DeltaGraphContainer(org.openrdf.model.URI namedGraphUri)
          Create a container of additions and deletions
DeltaGraphContainer(org.openrdf.model.URI namedGraphUri, java.util.Collection<org.openrdf.model.Statement> additions, java.util.Collection<org.openrdf.model.Statement> deletions)
          Create a container of additions and deletions with the provided additions and deletions
 
Method Summary
 void add(org.openrdf.model.Statement... statements)
          Add a triple to the delta.
 void apply(INamedGraph graph)
          Apply the deltas contained in this BasicGraph to the provided graph.
 void clear()
          Clear the delta of all changes.
 boolean containsAddition(org.openrdf.model.Statement statement)
          Determine if delta contain this triple in its set of additions
 boolean containsDeletion(org.openrdf.model.Statement statement)
          Determine if the delta contain this triple in its set of deletions
 void delete(org.openrdf.model.Statement... statements)
          Delete a triple to the delta.
 void filter(java.util.Collection<org.openrdf.model.Statement> results, org.openrdf.model.Resource s, org.openrdf.model.URI p, org.openrdf.model.Value o)
          Filter an ExtendedIterator with the additions that match a TripleMatch and deletions in this delta
 void filter(java.util.Collection<org.openrdf.model.Statement> results, org.openrdf.model.Statement match)
          Filter an ExtendedIterator with the additions that match a TripleMatch and deletions in this delta
static java.util.Collection<org.openrdf.model.Statement> findMatches(java.util.Collection<org.openrdf.model.Statement> statements, org.openrdf.model.Resource s, org.openrdf.model.URI p, org.openrdf.model.Value o)
          Find set of statements that match provided pattern
 java.util.Collection<org.openrdf.model.Statement> getAdditions()
          Get the additions within this delta
 java.util.Collection<org.openrdf.model.Statement> getDeletions()
          Get the deletions within this delta
 int size()
          Get the number of changes contained in this delta
 void unapply(INamedGraph graph)
          Unapply the deltas contained in this BasicGraph to the provided graph.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeltaGraphContainer

public DeltaGraphContainer(org.openrdf.model.URI namedGraphUri)
Create a container of additions and deletions

Parameters:
namedGraphUri - URI of graph for which this is acting as a delta

DeltaGraphContainer

public DeltaGraphContainer(org.openrdf.model.URI namedGraphUri,
                           java.util.Collection<org.openrdf.model.Statement> additions,
                           java.util.Collection<org.openrdf.model.Statement> deletions)
Create a container of additions and deletions with the provided additions and deletions

Parameters:
namedGraphUri - URI of graph for which this is acting as a delta
additions - Triples added in this delta
deletions - Triples deleted in this delta
Method Detail

add

public void add(org.openrdf.model.Statement... statements)
Add a triple to the delta. If the triple already existed in the Base Graph, but had been deleted within this delta, remove the deletion from delta. If the triple is new, add it to the additions delta, and the localAdditions.

Parameters:
statements - New statements to add

delete

public void delete(org.openrdf.model.Statement... statements)
Delete a triple to the delta. If the triple was added to the Base Graph within this delta, remove the addition from delta. If the triple existed in the base graph already, add it to the deletions delta, and the localDeletions.

Parameters:
statements - New statements to add

containsDeletion

public boolean containsDeletion(org.openrdf.model.Statement statement)
Determine if the delta contain this triple in its set of deletions

Parameters:
statement - statement to check
Returns:
if the delta contain this triple in its set of deletions

containsAddition

public boolean containsAddition(org.openrdf.model.Statement statement)
Determine if delta contain this triple in its set of additions

Parameters:
statement - statement to check
Returns:
if delta contain this triple in its set of additions

filter

public void filter(java.util.Collection<org.openrdf.model.Statement> results,
                   org.openrdf.model.Resource s,
                   org.openrdf.model.URI p,
                   org.openrdf.model.Value o)
Filter an ExtendedIterator with the additions that match a TripleMatch and deletions in this delta

Parameters:
results - set of Statements to filter
s - The subject of the statement pattern being searched on.
p - The property of the statement pattern being searched on.
o - The object of the statement pattern being searched on.

filter

public void filter(java.util.Collection<org.openrdf.model.Statement> results,
                   org.openrdf.model.Statement match)
Filter an ExtendedIterator with the additions that match a TripleMatch and deletions in this delta

Parameters:
results - set of Statements to filter
match - The Statement pattern being searched on.

findMatches

public static java.util.Collection<org.openrdf.model.Statement> findMatches(java.util.Collection<org.openrdf.model.Statement> statements,
                                                                            org.openrdf.model.Resource s,
                                                                            org.openrdf.model.URI p,
                                                                            org.openrdf.model.Value o)
Find set of statements that match provided pattern

Parameters:
statements - Set of statements to determine match status
s - The subject of the statement pattern being searched on.
p - The property of the statement pattern being searched on.
o - The object of the statement pattern being searched on.
Returns:
Set of statements that match pattern

clear

public void clear()
Clear the delta of all changes.


apply

public void apply(INamedGraph graph)
Apply the deltas contained in this BasicGraph to the provided graph.

Parameters:
graph - Graph to apply changes

unapply

public void unapply(INamedGraph graph)
Unapply the deltas contained in this BasicGraph to the provided graph.

Parameters:
graph - Graph to apply changes

size

public int size()
Get the number of changes contained in this delta

Returns:
the number of changes contained in this delta

getAdditions

public java.util.Collection<org.openrdf.model.Statement> getAdditions()
Get the additions within this delta

Returns:
the additions within this delta

getDeletions

public java.util.Collection<org.openrdf.model.Statement> getDeletions()
Get the deletions within this delta

Returns:
the deletions within this delta


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