org.gcube.data.tr.neo
Class NeoStore

java.lang.Object
  extended by org.gcube.data.tr.neo.NeoStore
All Implemented Interfaces:
Serializable, Store

public class NeoStore
extends Object
implements Store

See Also:
Serialized Form

Constructor Summary
NeoStore(NeoDBProvider provider, String storeId)
           
NeoStore(String storeId)
           
 
Method Summary
 void _start(File location)
           
 org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> add(org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> treeStream)
          Adds many trees at once to the store.
 org.gcube.data.trees.data.Tree add(org.gcube.data.trees.data.Tree tree)
          WRITE OPERATIONS
 long cardinality()
          Returns the cardinality of the store.
 org.neo4j.graphdb.GraphDatabaseService dbservice()
           
 void delete()
          Deletes a store, stopping it if it has been started.
 Iterator<org.gcube.data.trees.data.Tree> get(org.gcube.data.trees.patterns.Pattern pattern)
          Returns all the trees in the store which match a given pattern, after pruning them with it.
 org.gcube.data.trees.data.Tree get(String id, org.gcube.data.trees.patterns.Pattern pattern)
          READ OPERATIONS
 String id()
          Returns the store identifier.
 File location()
          Returns the location of the store.
 void start(File storageLocation)
          LIFETIME OPERATIONS
 void stop()
          Stops a started store.
 String toString()
           
 org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> update(org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> deltaStream)
          Updates many trees at once in the store with the delta trees that capture their changes.
 org.gcube.data.trees.data.Tree update(org.gcube.data.trees.data.Tree delta)
          Updates a tree in the store with the delta tree that captures the changes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NeoStore

public NeoStore(String storeId)
         throws IllegalStateException
Throws:
IllegalStateException

NeoStore

public NeoStore(NeoDBProvider provider,
                String storeId)
         throws IllegalStateException
Throws:
IllegalStateException
Method Detail

id

public String id()
Description copied from interface: Store
Returns the store identifier.

Specified by:
id in interface Store
Returns:
the identifier

location

public File location()
Description copied from interface: Store
Returns the location of the store.

Specified by:
location in interface Store
Returns:
the location

cardinality

public long cardinality()
Description copied from interface: Store
Returns the cardinality of the store.

Specified by:
cardinality in interface Store
Returns:
the cardinality

dbservice

public org.neo4j.graphdb.GraphDatabaseService dbservice()

start

public void start(File storageLocation)
LIFETIME OPERATIONS

Specified by:
start in interface Store
Parameters:
storageLocation - the location

_start

public void _start(File location)

stop

public void stop()
Stops a started store.

Specified by:
stop in interface Store

delete

public void delete()
Deletes a store, stopping it if it has been started.

Specified by:
delete in interface Store

get

public org.gcube.data.trees.data.Tree get(String id,
                                          org.gcube.data.trees.patterns.Pattern pattern)
                                   throws org.gcube.data.tmf.api.exceptions.UnknownTreeException,
                                          org.gcube.data.tmf.api.exceptions.InvalidTreeException
READ OPERATIONS

Specified by:
get in interface Store
Parameters:
id - the identifier
pattern - the pattern
Returns:
the tree
Throws:
org.gcube.data.tmf.api.exceptions.UnknownTreeException - if the store does not contain a tree with the given identifier
org.gcube.data.tmf.api.exceptions.InvalidTreeException - if the Tree with the the given identifier does not match the Pattern

get

public Iterator<org.gcube.data.trees.data.Tree> get(org.gcube.data.trees.patterns.Pattern pattern)
Description copied from interface: Store
Returns all the trees in the store which match a given pattern, after pruning them with it.

Specified by:
get in interface Store
Parameters:
pattern - the pattern
Returns:
a stream of matching and pruned trees

add

public org.gcube.data.trees.data.Tree add(org.gcube.data.trees.data.Tree tree)
                                   throws org.gcube.data.tmf.api.exceptions.InvalidTreeException
WRITE OPERATIONS

Specified by:
add in interface Store
Returns:
the input tree with any change post insertion
Throws:
org.gcube.data.tmf.api.exceptions.InvalidTreeException - if the tree does is invalid for addition (e.g. some of its nodes have already identifiers)

update

public org.gcube.data.trees.data.Tree update(org.gcube.data.trees.data.Tree delta)
                                      throws org.gcube.data.tmf.api.exceptions.UnknownTreeException,
                                             org.gcube.data.tmf.api.exceptions.InvalidTreeException
Description copied from interface: Store
Updates a tree in the store with the delta tree that captures the changes.

Specified by:
update in interface Store
Parameters:
delta - the delta tree
Returns:
the updated tree
Throws:
org.gcube.data.tmf.api.exceptions.UnknownTreeException - if the delta tree does not identify a tree in the store
org.gcube.data.tmf.api.exceptions.InvalidTreeException - if the delta tree does now qualify for update

add

public org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> add(org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> treeStream)
                                                                  throws Exception
Description copied from interface: Store
Adds many trees at once to the store.

Specified by:
add in interface Store
Parameters:
treeStream - the stream of trees
Returns:
a stream of outcomes, one per tree in the input stream and in the same relative order.
Throws:
Exception - if the operation fails as a whole for an unexpected error

update

public org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> update(org.gcube.data.streams.Stream<org.gcube.data.trees.data.Tree> deltaStream)
                                                                     throws Exception
Description copied from interface: Store
Updates many trees at once in the store with the delta trees that capture their changes.

Specified by:
update in interface Store
Parameters:
deltaStream - the delta trees
Returns:
a stream of outcomes, one per tree in the input stream and in the same relative order.
Throws:
Exception - if the operation fails as a whole for an expected error

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.