Package uk.gov.gchq.gaffer.store.library
Class GraphLibrary
- java.lang.Object
-
- uk.gov.gchq.gaffer.store.library.GraphLibrary
-
- Direct Known Subclasses:
FileGraphLibrary,HashMapGraphLibrary,NoGraphLibrary
public abstract class GraphLibrary extends Object
AGraphLibrarystores a graphId and its related Schema and StoreProperties.
-
-
Field Summary
Fields Modifier and Type Field Description static StringA_GRAPH_LIBRARY_CAN_T_BE_ADDED_WITH_A_NULL_S_GRAPH_ID_S
-
Constructor Summary
Constructors Constructor Description GraphLibrary()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidadd(String graphId, String schemaId, Schema schema, String propertiesId, StoreProperties properties)Add a new relationship between a graphId, Schema and StoreProperties.voidadd(String graphId, Schema schema, StoreProperties properties)Add a new relationship between a graphId, Schema and StoreProperties.voidaddOrUpdate(String graphId, String schemaId, Schema schema, String propertiesId, StoreProperties properties)Adds a new relationship between a graphId, Schema and StoreProperties.voidaddOrUpdate(String graphId, Schema schema, StoreProperties properties)Adds a new relationship between a graphId, Schema and StoreProperties.voidaddOrUpdateProperties(String id, StoreProperties properties)Adds a new relationship between a StoreProperties and a storePropertiesId.voidaddOrUpdateSchema(String id, Schema schema)Adds a new relationship between a Schema and schemaId.voidaddProperties(String id, StoreProperties properties)Adds a new relationship between a StoreProperties and a storePropertiesId.voidaddSchema(String id, Schema schema)Adds a new relationship between a Schema and a schemaId.voidcheckExisting(String graphId, Schema schema, StoreProperties properties)booleanexists(String graphId)Checks if the graphId with a relationship already exists.Pair<Schema,StoreProperties>get(String graphId)Gets the Schema and StoreProperties related to the graphId.abstract Pair<String,String>getIds(String graphId)Gets the Schema Id and StoreProperties Id related to the graphId.StorePropertiesgetProperties(String propertiesId)Gets the StoreProperties given the storePropertiesId.SchemagetSchema(String schemaId)Gets the Schema given the schemaId.abstract voidinitialise(String path)SchemaresolveSchema(Schema schema, List<String> parentSchemaIds)StorePropertiesresolveStoreProperties(StoreProperties properties, String parentStorePropertiesId)
-
-
-
Field Detail
-
A_GRAPH_LIBRARY_CAN_T_BE_ADDED_WITH_A_NULL_S_GRAPH_ID_S
public static final String A_GRAPH_LIBRARY_CAN_T_BE_ADDED_WITH_A_NULL_S_GRAPH_ID_S
- See Also:
- Constant Field Values
-
-
Method Detail
-
initialise
public abstract void initialise(String path)
-
add
public void add(String graphId, Schema schema, StoreProperties properties) throws OverwritingException
Add a new relationship between a graphId, Schema and StoreProperties.- Parameters:
graphId- The graphId to relate to.schema- The schema that relates to the graphId.properties- The StoreProperties that relate to the graphId.- Throws:
OverwritingException- If the graphId already has a related Schema and/or StoreProperties.
-
add
public void add(String graphId, String schemaId, Schema schema, String propertiesId, StoreProperties properties) throws OverwritingException
Add a new relationship between a graphId, Schema and StoreProperties.- Parameters:
graphId- The graphId to relate to.schemaId- the schema idschema- The schema that relates to the graphId.propertiesId- the properties idproperties- The StoreProperties that relate to the graphId.- Throws:
OverwritingException- If the graphId already has a related Schema and/or StoreProperties.
-
addOrUpdate
public void addOrUpdate(String graphId, Schema schema, StoreProperties properties)
Adds a new relationship between a graphId, Schema and StoreProperties. If there is already a relationship using the graphId, it will update it.- Parameters:
graphId- The graphId to relate to.schema- The schema that relates to the graphId.properties- The StoreProperties that relate to the graphId.
-
addOrUpdate
public void addOrUpdate(String graphId, String schemaId, Schema schema, String propertiesId, StoreProperties properties)
Adds a new relationship between a graphId, Schema and StoreProperties. If there is already a relationship using the graphId, it will update it.- Parameters:
graphId- The graphId to relate to.schemaId- the schema idschema- The schema that relates to the graphId.propertiesId- the properties idproperties- The StoreProperties that relate to the graphId.
-
get
public Pair<Schema,StoreProperties> get(String graphId)
Gets the Schema and StoreProperties related to the graphId.- Parameters:
graphId- The graphId.- Returns:
- a
uk.gov.gchq.gaffer.commonutil.paircontaining related Schema and StoreProperties.
-
getIds
public abstract Pair<String,String> getIds(String graphId)
Gets the Schema Id and StoreProperties Id related to the graphId.- Parameters:
graphId- The graphId.- Returns:
- A
uk.gov.gchq.gaffer.commonutil.paircontaining related Schema Id and StoreProperties Id.
-
getSchema
public Schema getSchema(String schemaId)
Gets the Schema given the schemaId.- Parameters:
schemaId- The schemaId.- Returns:
- The
Schemarelated to the schemaId.
-
getProperties
public StoreProperties getProperties(String propertiesId)
Gets the StoreProperties given the storePropertiesId.- Parameters:
propertiesId- The storePropertiesId- Returns:
- The
StorePropertiesrelated to the storePropertiesId.
-
exists
public boolean exists(String graphId)
Checks if the graphId with a relationship already exists.- Parameters:
graphId- The GraphId.- Returns:
- True if a relationship exists.
-
addSchema
public void addSchema(String id, Schema schema) throws OverwritingException
Adds a new relationship between a Schema and a schemaId.- Parameters:
id- the schema IDschema- the Schema.- Throws:
OverwritingException- If there is already a relationship.
-
addOrUpdateSchema
public void addOrUpdateSchema(String id, Schema schema)
Adds a new relationship between a Schema and schemaId. If there is already an existing relationship, it will update it.- Parameters:
id- The schema idschema- The schema
-
addProperties
public void addProperties(String id, StoreProperties properties) throws OverwritingException
Adds a new relationship between a StoreProperties and a storePropertiesId.- Parameters:
id- the properties ID.properties- the StoreProperties.- Throws:
OverwritingException- If there is already a relationship.
-
addOrUpdateProperties
public void addOrUpdateProperties(String id, StoreProperties properties)
Adds a new relationship between a StoreProperties and a storePropertiesId. If there is already an existing relationship, it will update it.- Parameters:
id- the properties ID.properties- the StoreProperties.
-
checkExisting
public void checkExisting(String graphId, Schema schema, StoreProperties properties)
-
resolveStoreProperties
public StoreProperties resolveStoreProperties(StoreProperties properties, String parentStorePropertiesId)
-
-