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
AGraphLibrary
stores a graphId and its related Schema and StoreProperties.
-
-
Field Summary
Fields Modifier and Type Field Description static String
A_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 void
add(String graphId, String schemaId, Schema schema, String propertiesId, StoreProperties properties)
Add a new relationship between a graphId, Schema and StoreProperties.void
add(String graphId, Schema schema, StoreProperties properties)
Add a new relationship between a graphId, Schema and StoreProperties.void
addOrUpdate(String graphId, String schemaId, Schema schema, String propertiesId, StoreProperties properties)
Adds a new relationship between a graphId, Schema and StoreProperties.void
addOrUpdate(String graphId, Schema schema, StoreProperties properties)
Adds a new relationship between a graphId, Schema and StoreProperties.void
addOrUpdateProperties(String id, StoreProperties properties)
Adds a new relationship between a StoreProperties and a storePropertiesId.void
addOrUpdateSchema(String id, Schema schema)
Adds a new relationship between a Schema and schemaId.void
addProperties(String id, StoreProperties properties)
Adds a new relationship between a StoreProperties and a storePropertiesId.void
addSchema(String id, Schema schema)
Adds a new relationship between a Schema and a schemaId.void
checkExisting(String graphId, Schema schema, StoreProperties properties)
boolean
exists(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.StoreProperties
getProperties(String propertiesId)
Gets the StoreProperties given the storePropertiesId.Schema
getSchema(String schemaId)
Gets the Schema given the schemaId.abstract void
initialise(String path)
Schema
resolveSchema(Schema schema, List<String> parentSchemaIds)
StoreProperties
resolveStoreProperties(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.pair
containing 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.pair
containing related Schema Id and StoreProperties Id.
-
getSchema
public Schema getSchema(String schemaId)
Gets the Schema given the schemaId.- Parameters:
schemaId
- The schemaId.- Returns:
- The
Schema
related to the schemaId.
-
getProperties
public StoreProperties getProperties(String propertiesId)
Gets the StoreProperties given the storePropertiesId.- Parameters:
propertiesId
- The storePropertiesId- Returns:
- The
StoreProperties
related 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)
-
-