public abstract class OntologyDatabaseDriver extends Object
Constructor and Description |
---|
OntologyDatabaseDriver() |
Modifier and Type | Method and Description |
---|---|
abstract void |
clear()
Wipes the ontology database clean.
|
void |
close()
Gives the driver the opportunity to shut down properly.
|
void |
deleteAssociation(Association association)
Deletes the given association.
|
abstract void |
deleteAssociations(Collection<Association> associations)
Deletes the given associations.
|
abstract void |
deleteDictionaryEntries(Collection<NodeHandle> nodes)
Deletes the dictionary entries for the given nodes from the db.
|
void |
deleteDictionaryEntry(NodeHandle node)
Deletes the dictionary entries for a single node.
|
void |
deleteNode(NodeHandle node)
Deletes a single node from the database.
|
void |
deleteNodeDescriptors(Collection<NodeDescriptor> nodes)
Deletes the given nodes from the database.
|
abstract void |
deleteNodes(Collection<NodeHandle> nodes)
Deletes the given nodes from the database.
|
abstract void |
deleteOntology(OntologyHandle ontology)
Deletes the ontology with the given ontology handle.
|
abstract List<Collection<Association>> |
getAssociations(Collection<NodeHandle> nodes,
int associationTypes,
AssociationDirection dir)
Returns the associations for a given set of nodes.
|
Collection<Association> |
getAssociations(NodeHandle node,
int associationTypes,
AssociationDirection dir)
Returns the associations for a single node.
|
OntologyHandle |
getEmptyOntology(String name)
Returns an empty instance of the ontology with the given name.
|
NodeDescriptor |
getNode(NodeHandle node)
Returns the node descriptor for a single node.
|
abstract List<NodeDescriptor> |
getNodes(Collection<NodeHandle> handles)
Returns the node descriptors for the given node handles.
|
abstract Collection<OntologyHandle> |
getOntologies()
Returns a list containing all ontologies in the database and an empty
list if no ontologies are present.
|
OntologyHandle |
getOntology(String name)
Returns the handle for the ontology with the given name or creates the
ontology if it does not exist.
|
abstract OntologyHandle |
getOntology(String name,
boolean create)
Returns a the handle for the ontology with the given name or creates the
ontology if it does not exist.
|
abstract Date |
getOntologyModificationDate(OntologyHandle ontology)
Returns the last update date for the given ontology handle.
|
abstract Collection<NodeDescriptor> |
getRootNodes(OntologyHandle ontology)
Returns a list containing all root nodes in the given ontology.
|
String |
getSchemaVersion()
Gives the driver the opportunity to return a database version number.
|
static Collection<NodeHandle> |
nodeHandlesFromDescriptors(Collection<NodeDescriptor> nodes)
Converts a list of node descriptors to a list of node handles.
|
boolean |
queryAllNodesExist(Collection<NodeHandle> handles)
Checks whether all given nodes exist.
|
abstract Map<String,Collection<NodeDescriptor>> |
queryDictionary(Set<String> keys)
Queries the dictionary for the given keys.
|
Collection<NodeDescriptor> |
queryDictionary(String key)
Queries the dictionary for a given key.
|
boolean |
queryNodeExists(NodeHandle handle)
Checks whether the given node handle is valid.
|
abstract List<Boolean> |
queryNodesExist(Collection<NodeHandle> handles)
Checks whether the given nodes exist.
|
abstract void |
setOntologyModificationDate(OntologyHandle ontology,
Date date)
Returns the last update date for the given ontology handle.
|
void |
storeAssociation(Association association)
Stores the given associations.
|
abstract void |
storeAssociations(Collection<Association> associations)
Stores the given associations.
|
abstract void |
storeDictionaryEntries(Map<NodeHandle,Set<String>> keys)
Stores the given node to key associations in the dictionary.
|
void |
storeDictionaryEntry(NodeHandle handle,
Set<String> keys)
Stores the given node to key association in the dictionary.
|
void |
storeNode(NodeDescriptor node)
Stores a single node in the database.
|
abstract void |
storeNodes(Collection<NodeDescriptor> descriptors)
Stores the given nodes in the database.
|
public static Collection<NodeHandle> nodeHandlesFromDescriptors(Collection<NodeDescriptor> nodes)
nodes
- is a list of node descriptors.public abstract Collection<OntologyHandle> getOntologies()
public abstract OntologyHandle getOntology(String name, boolean create)
name
- is the name of the ontology that should be returned/created.create
- if true, the ontology is created if it does not exist yet,
if false, null is returned if the ontology does not exist yet.public OntologyHandle getOntology(String name)
name
- is the name of the ontology that should be returned/created.public abstract Date getOntologyModificationDate(OntologyHandle ontology)
ontology
- is the handle of the ontology for which the modification
date should be returned.public abstract void setOntologyModificationDate(OntologyHandle ontology, Date date)
ontology
- is the handle of the ontology for which the modification
date should be updated.date
- is the date the modification date should be set to.public abstract void deleteOntology(OntologyHandle ontology)
ontology
- is the handle of the ontology that should be deleted.public OntologyHandle getEmptyOntology(String name)
name
- is the name of the ontology that should be returned.public abstract Collection<NodeDescriptor> getRootNodes(OntologyHandle ontology)
ontology
- is the ontology for which the root nodes should be
returned.public abstract List<NodeDescriptor> getNodes(Collection<NodeHandle> handles)
handles
- is a list of node handles.public NodeDescriptor getNode(NodeHandle node)
node
- is the node that should be looked up in the database.public abstract List<Boolean> queryNodesExist(Collection<NodeHandle> handles)
handles
- is a list of node handles.public boolean queryAllNodesExist(Collection<NodeHandle> handles)
handles
- is a list of node handles.public boolean queryNodeExists(NodeHandle handle)
handle
- is a node handle.public abstract void storeNodes(Collection<NodeDescriptor> descriptors)
descriptors
- is a list of node descriptors that should be stored.
Invalid node descriptors (e.g. refering to a non existing ontology) must
be ignored.
TODO: Check this in the unit test/implementation, as this is not done at
the moment (would probably be to costly).public void storeNode(NodeDescriptor node)
node
- is the node that should be stored.public abstract void deleteNodes(Collection<NodeHandle> nodes)
nodes
- is a list containing the nodes that should be deleted.public void deleteNode(NodeHandle node)
node
- is the node that should be deleted.public void deleteNodeDescriptors(Collection<NodeDescriptor> nodes)
nodes
- is a list containing the nodes that should be deleted.public abstract List<Collection<Association>> getAssociations(Collection<NodeHandle> nodes, int associationTypes, AssociationDirection dir)
nodes
- is a list of nodes.associationTypes
- is a bit field containing the association types
that should be returned.dir
- is the association direction that should be returned.public Collection<Association> getAssociations(NodeHandle node, int associationTypes, AssociationDirection dir)
node
- is the node for which the associations should be returned.associationTypes
- is a bit field containing the association types
that should be returned.dir
- is the association direction that should be returned.public abstract void storeAssociations(Collection<Association> associations)
associations
- is a list of associations that should be stored. The
database does not have to check whether the associations are actually
valid.
TODO: Change this?public void storeAssociation(Association association)
association
- is an association that should be stored. The database
does not have to check whether the associations are valid.public abstract void deleteAssociations(Collection<Association> associations)
associations
- is a list of associations that should be deleted.public void deleteAssociation(Association association)
association
- the association that should be deleted.public abstract Map<String,Collection<NodeDescriptor>> queryDictionary(Set<String> keys)
keys
- contains a set of keys that should be queried.public Collection<NodeDescriptor> queryDictionary(String key)
key
- contains a set of keys that should be queried.public abstract void storeDictionaryEntries(Map<NodeHandle,Set<String>> keys)
keys
- is a map from node handles to keys that should be stored in
the dictionary.public void storeDictionaryEntry(NodeHandle handle, Set<String> keys)
handle
- is the handle for which the keys should be stored in the
db.keys
- is list of keys that should be associated to the given
handles.public abstract void deleteDictionaryEntries(Collection<NodeHandle> nodes)
nodes
- is a list of nodes for which the dictionary entries should
be deleted.public void deleteDictionaryEntry(NodeHandle node)
node
- is the node for which the dictionary entries should be
deleted.public void close()
public String getSchemaVersion()
public abstract void clear()
Copyright (C) 2013, 2014 Raphael Dickfelder, Jan Göpfert, Benjamin Paassen, Andreas Stöckel, licensed under the AGPL v. 3: http://openresearch.cit-ec.de/projects/scie