Package com.semedy.reasoner.api.core
Class JSONDeductiveDatabase
java.lang.Object
com.semedy.reasoner.api.core.JSONDeductiveDatabase
Interface for Json objects.
Json objects can be added, removed, and queried for.
A json must have the properties @id, @type
Jsons schemas can also be stored. If a schema
with id = C is there an instance with type = C
is validated against this schema.
Json objects can be added, removed, and queried for.
A json must have the properties @id, @type
Jsons schemas can also be stored. If a schema
with id = C is there an instance with type = C
is validated against this schema.
- Author:
- angele
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddJsonObject(org.json.JSONObject json) add a JSON objectbooleanaddJsonObject(org.json.JSONObject json, Object module) add a JSON objectbooleanaddJsonObjects(String objects) add a set of JSON objects, given as a Json array in a string.booleanaddJsonObjects(String objects, Object module) add a set of JSON objects, given as a Json array in a string.booleanaddJsonObjects(Collection<org.json.JSONObject> objects) add a set of JSON objects.booleanaddJsonObjects(Collection<org.json.JSONObject> objects, Object module) add a set of JSON objects.booleanaddJsonObjects(org.json.JSONArray objects) add a set of JSON objects given in a Json arraybooleanaddJsonObjects(org.json.JSONArray objects, String module) add a set of JSON objects given in a Json arraystatic voidclear()clear allvoidexportJson(String path, Set<String> excludedProperties) Export jsons into filevoidexportJSONSchemas(Writer writer, boolean inherit) export OO-Logic classes as Json Schemas.voidexportJSONSchemas(String path, boolean inherit) export OO-Logic classes as Json Schemas.getAvailableIdentifiers(List<String> identifiers) Which of the given json identifiers are there?getAvailableIdentifiers(List<String> identifiers, Configuration config, Properties builtinConfig) Which of the given json identifiers are there?getAvailableIdentifiers(List<String> identifiers, String module, Configuration config, Properties builtinConfig) Which of the given json identifiers are there?Returns the deductive database which is used inside the JSONDeductiveDatabase.getJSONSchemas(boolean inherit) get OO-Logic classes as Json Schemas.org.json.JSONObjectgetSchema(String schemaid, Configuration config, Properties builtinConfig) get schema with id schemaidintrospectionQueryGraphQL(String graphQLQuery, String module, String variables, Configuration config, Properties builtinConfig) booleanisIdentifierAvailable(String identifier) Is this identifier for a json object there?booleanisIdentifierAvailable(String identifier, Configuration config, Properties builtinConfig) Is this identifier for a json object there?booleanisIdentifierAvailable(String identifier, String module, Configuration config, Properties builtinConfig) Is this identifier for a json object there?voidImport from a json filesvoidImport from a list of json filesvoidloadByStream(InputStream in, InputStream companionstream, String format) load facts by stream.List<org.json.JSONObject>queryJsonObjects(String ooquery) Query JSON Objects using an OO-logic query.List<org.json.JSONObject>queryJsonObjects(String ooquery, String module) Query JSON Objects using an OO-logic query.List<org.json.JSONObject>queryJsonObjects(String ooquery, String module, Configuration config, Properties builtinConfig) Query JSON Objects using an OO-logic query.List<org.json.JSONObject>queryJsonObjects(String ooquery, Properties builtinProperties) Query JSON Objects using an OO-logic query.List<org.json.JSONObject>queryJsonObjects(Collection<String> identifiers) query JSON objects using the json identifiers (@id) in module
Json objects can be derivedList<org.json.JSONObject>queryJsonObjects(Collection<String> identifiers, Configuration config, Properties builtinConfig) query JSON objects using the json identifiers (@id) in module
Json objects can be derivedList<org.json.JSONObject>queryJsonObjects(Collection<String> identifiers, Object module, Configuration config, Properties builtinConfig) query JSON objects using the json identifiers (@id) in module
Json objects can be derivedorg.json.JSONObjectqueryJsonObjectsByGraphQL(String graphQLQuery, String module, String variables, Configuration config, Properties builtinConfig) Query JSON Objects using a GraphQL query.booleanremoveJsonObject(String identifier) Json object with given id (@id) is deletedbooleanremoveJsonObject(String identifier, Configuration config, Properties builtinConfig) Json object with given id (@id) is deletedbooleanremoveJsonObjects(Collection<String> identifiers) Json objects with given ids (@id) are deletedbooleanremoveJsonObjects(Collection<String> identifiers, Configuration config, Properties builtinConfig) Json objects with given ids (@id) are deletedbooleanremoveJsonObjects(Collection<String> identifiers, String module, Configuration config, Properties builtinConfig) Json objects with given ids (@id) are deletedorg.json.JSONObjectretrieveJsonObject(String identifier, Configuration config, Properties builtinConfig) retrieve JSON object using the json identifier (@id)List<org.json.JSONObject>retrieveJsonObjects(String ooquery) Retrieve JSON Objects using an OO-logic query and a module.List<org.json.JSONObject>retrieveJsonObjects(String ooquery, Configuration config, Properties builtinConfig) Retrieve JSON Objects using an OO-logic query.List<org.json.JSONObject>retrieveJsonObjects(String ooquery, Properties builtinProperties) Retrieve JSON Objects using an OO-logic query and a module.List<org.json.JSONObject>retrieveJsonObjects(Collection<String> identifiers) retrieve JSON objects using the json identifiers (@id)List<org.json.JSONObject>retrieveJsonObjects(Collection<String> identifiers, boolean initializeTransaction) retrieve JSON objects using the json identifiers (@id)List<org.json.JSONObject>retrieveJsonObjects(Collection<String> identifiers, boolean initializeTransaction, Properties builtinConfig) retrieve JSON objects using the json identifiers (@id)List<org.json.JSONObject>retrieveJsonObjects(Collection<String> identifiers, Configuration config, Properties builtinConfig) retrieve JSON objects using the json identifiers (@id)List<org.json.JSONObject>retrieveJsonObjects(Collection<String> identifiers, Configuration config, Properties builtinConfig, boolean initializeTransaction) retrieve JSON objects using the json identifiers (@id)retrieveJsons(String ooquery, int maxNumberOfResults, Configuration config, Properties builtinConfig) Retrieve JSON Objects using an OO-logic query.retrieveJsons(String ooquery, Configuration config, Properties builtinConfig) Retrieve JSON Objects using an OO-logic query.List<org.json.JSONObject>retrieveTuples(String query, Configuration config, Properties builtinConfig) Retrieve tuples (variable substitutions) for a given query
E.g. query ?voidsetReasoningMonitor(ReasoningMonitor monitor) set a reasoning monitorvoidstart a transactionvoidcommit transactionvoidrollback transactionbooleanvalidateJsonObjects(List<org.json.JSONObject> jsons, String schemaid) Validate json objects against a stored schema with @id "schema".
Returns true if the schema was available and it has been successfully validated.booleanvalidateJsonObjects(List<org.json.JSONObject> jsons, String schemaid, Configuration config, Properties builtinConfig) Validate json objects against a stored schema with @id "schema".
Returns true if the schema was available and it has been successfully validated.voidvalidateJsonObjects(List<org.json.JSONObject> jsons, org.json.JSONObject schema, Properties builtinConfig) Validate json objects against a schema.
-
Constructor Details
-
JSONDeductiveDatabase
- Throws:
IOExceptionSemReasonerException
-
-
Method Details
-
clear
public static void clear()clear all -
setReasoningMonitor
set a reasoning monitor- Parameters:
monitor-
-
exportJSONSchemas
public void exportJSONSchemas(String path, boolean inherit) throws IOException, SemReasonerException, InterruptedException export OO-Logic classes as Json Schemas.
For properties ranges are exported only (no comment, no minCardinality) maxCardinality is used for creating array types- Parameters:
path- , the path for the export fileinherit- , integrate inherited properties into schema- Throws:
IOExceptionSemReasonerExceptionInterruptedException
-
exportJSONSchemas
public void exportJSONSchemas(Writer writer, boolean inherit) throws IOException, SemReasonerException, InterruptedException export OO-Logic classes as Json Schemas.
For properties ranges are exported only (no comment, no minCardinality) maxCardinality is used for creating array types- Parameters:
writer-inherit- , integrate inherited properties into schema- Throws:
IOExceptionSemReasonerExceptionInterruptedException
-
getJSONSchemas
public Map<String,org.json.JSONObject> getJSONSchemas(boolean inherit) throws IOException, SemReasonerException, InterruptedException get OO-Logic classes as Json Schemas.
For properties ranges are exported only.
maxCardinality is used for creating array types- Parameters:
inherit- , inherit means that properties are inherited top-down- Returns:
- Throws:
IOExceptionSemReasonerExceptionInterruptedException
-
getSchema
public org.json.JSONObject getSchema(String schemaid, Configuration config, Properties builtinConfig) throws InterruptedException, IOException, SemReasonerException get schema with id schemaid- Parameters:
schemaid- , id of schema, i.e. Personconfig- , configurationbuiltinConfig- , builtin configuration- Returns:
- Throws:
InterruptedExceptionIOExceptionSemReasonerException
-
addJsonObjects
public boolean addJsonObjects(org.json.JSONArray objects, String module) throws IOException, SemReasonerException, InterruptedException add a set of JSON objects given in a Json array- Parameters:
objects- , JSON objectsmodule- , module to add json object to- Returns:
- Throws:
IOExceptionSemReasonerExceptionInterruptedExceptionReasoningException
-
addJsonObjects
public boolean addJsonObjects(org.json.JSONArray objects) throws IOException, SemReasonerException, ReasoningException, InterruptedException add a set of JSON objects given in a Json array- Parameters:
objects- , JSON objects- Returns:
- Throws:
IOExceptionSemReasonerExceptionInterruptedExceptionReasoningException
-
addJsonObject
public boolean addJsonObject(org.json.JSONObject json) throws IOException, SemReasonerException, ReasoningException, InterruptedException add a JSON object- Parameters:
json- , a JSON object- Returns:
- Throws:
IOExceptionSemReasonerExceptionInterruptedExceptionReasoningException
-
addJsonObjects
public boolean addJsonObjects(Collection<org.json.JSONObject> objects, Object module) throws IOException, SemReasonerException, ReasoningException, InterruptedException add a set of JSON objects.- Parameters:
objects- , JSON objectsmodule- , module to add json object to- Returns:
- Throws:
IOExceptionSemReasonerExceptionInterruptedExceptionReasoningException
-
addJsonObject
public boolean addJsonObject(org.json.JSONObject json, Object module) throws IOException, SemReasonerException, ReasoningException, InterruptedException add a JSON object- Parameters:
json- , a JSON objectmodule- , module to add json object to- Returns:
- Throws:
IOExceptionSemReasonerExceptionReasoningExceptionInterruptedException
-
addJsonObjects
public boolean addJsonObjects(Collection<org.json.JSONObject> objects) throws IOException, SemReasonerException, ReasoningException, InterruptedException add a set of JSON objects.- Parameters:
objects- , JSON objects- Returns:
- Throws:
IOExceptionSemReasonerExceptionInterruptedExceptionReasoningException
-
addJsonObjects
public boolean addJsonObjects(String objects) throws IOException, SemReasonerException, ReasoningException, InterruptedException add a set of JSON objects, given as a Json array in a string.- Parameters:
objects- , JSON objects- Returns:
- Throws:
IOExceptionSemReasonerExceptionInterruptedExceptionReasoningException
-
addJsonObjects
public boolean addJsonObjects(String objects, Object module) throws IllegalArgumentException, IllegalAccessException, IOException, SemReasonerException, ReasoningException, InterruptedException add a set of JSON objects, given as a Json array in a string.- Parameters:
objects- , JSON objectsmodule- , module to add json object to- Returns:
- Throws:
IllegalAccessExceptionIllegalArgumentExceptionIOExceptionSemReasonerExceptionInterruptedExceptionReasoningException
-
queryJsonObjects
public List<org.json.JSONObject> queryJsonObjects(String ooquery) throws InterruptedException, IOException, SemReasonerException Query JSON Objects using an OO-logic query.
The conditions must contain
conditions on the properties to select the objects.
Json objects can be derived objects As variable for the instances of the class ?Id is used.
e.g. ?- ?Id:Person, ?Id[name:?Y,age:?Z], ?Y="Kevin",?Z>20.- Parameters:
ooquery- , OO-logic query to filter the objects- Returns:
- Throws:
IOExceptionInterruptedExceptionSemReasonerException
-
queryJsonObjects
public List<org.json.JSONObject> queryJsonObjects(String ooquery, Properties builtinProperties) throws InterruptedException, IOException, SemReasonerException Query JSON Objects using an OO-logic query.
The conditions must contain
conditions on the properties to select the objects.
Json objects can be derived objects As variable for the instances of the class ?Id is used.
e.g. ?- ?Id:Person, ?Id[name:?Y,age:?Z], ?Y="Kevin",?Z>20.- Parameters:
ooquery- , OO-logic query to filter the objectsbuiltinProperties- , properties to control built-ins and rewriters- Returns:
- Throws:
IOExceptionInterruptedExceptionSemReasonerException
-
queryJsonObjects
public List<org.json.JSONObject> queryJsonObjects(String ooquery, String module) throws InterruptedException, IOException, SemReasonerException Query JSON Objects using an OO-logic query.
The conditions must contain
conditions on the properties to select the objects.
Json objects can be derived objects As variable for the instances of the class ?Id is used.
e.g. ?- ?Id:Person, ?Id[name:?Y,age:?Z], ?Y="Kevin",?Z>20.- Parameters:
ooquery- , OO-logic query to filter the objectsmodule- , the module to be searched in- Returns:
- Throws:
IOExceptionInterruptedExceptionSemReasonerException
-
queryJsonObjects
public List<org.json.JSONObject> queryJsonObjects(String ooquery, String module, Configuration config, Properties builtinConfig) throws InterruptedException, IOException, SemReasonerException Query JSON Objects using an OO-logic query.
The conditions must contain
conditions on the properties to select the objects.
Json objects can be derived objects. As variable for the instances of the class ?Id is used.
e.g. ?- ?Id:Person, ?Id[name:?Y,age:?Z], ?Y="Kevin",?Z>20.- Parameters:
ooquery- , OO-logic query to filter the objectsmodule- , the module to be searched in, null for all modulesconfig- , configurationbuiltinConfig- , built-in configuration like access token- Returns:
- Throws:
IOExceptionSemReasonerExceptionInterruptedException
-
introspectionQueryGraphQL
public String introspectionQueryGraphQL(String graphQLQuery, String module, String variables, Configuration config, Properties builtinConfig) throws SemReasonerException, IOException, InterruptedException -
queryJsonObjectsByGraphQL
public org.json.JSONObject queryJsonObjectsByGraphQL(String graphQLQuery, String module, String variables, Configuration config, Properties builtinConfig) throws SemReasonerException, IOException, InterruptedException Query JSON Objects using a GraphQL query.- Parameters:
graphQLQuery-module- , different modules may be distinguishedvariables- , variables to be substituted in the queryconfig-builtinConfig-- Returns:
- Throws:
SemReasonerExceptionIOExceptionInterruptedException
-
retrieveJsonObjects
public List<org.json.JSONObject> retrieveJsonObjects(String ooquery) throws ReasoningException, InterruptedException, IOException, SemReasonerException Retrieve JSON Objects using an OO-logic query and a module.
The conditions must contain
conditions on the properties to select the objects.
Json objects are retrieved only; no derived Json objects are returned
As variable for the instances of the class ?Id is used.
e.g. ?- ?Id:Person, ?Id[name:?Y,age:?Z], ?Y="Kevin",?Z>20.- Parameters:
ooquery- , OO-logic query to filter the objects- Returns:
- Throws:
IOExceptionInterruptedExceptionReasoningExceptionSemReasonerException
-
retrieveJsonObjects
public List<org.json.JSONObject> retrieveJsonObjects(String ooquery, Properties builtinProperties) throws ReasoningException, InterruptedException, IOException, SemReasonerException Retrieve JSON Objects using an OO-logic query and a module.
The conditions must contain
conditions on the properties to select the objects.
Json objects are retrieved only; no derived Json objects are returned
As variable for the instances of the class ?Id is used.
e.g. ?- ?Id:Person, ?Id[name:?Y,age:?Z], ?Y="Kevin",?Z>20.- Parameters:
ooquery- , OO-logic query to filter the objectsbuiltinProperties- , properties to control built-ins and rewriters- Returns:
- Throws:
IOExceptionInterruptedExceptionReasoningExceptionSemReasonerException
-
retrieveJsonObjects
public List<org.json.JSONObject> retrieveJsonObjects(String ooquery, Configuration config, Properties builtinConfig) throws ReasoningException, InterruptedException, IOException, SemReasonerException Retrieve JSON Objects using an OO-logic query.
The conditions must contain
conditions on the properties to select the objects.
Json objects are retrieved only; no derived Json objects are returned
As variable for the instances of the class ?Id is used.
e.g. ?- ?Id:Person, ?Id[name:?Y,age:?Z], ?Y="Kevin",?Z>20.- Parameters:
ooquery- , OO-logic query to filter the objectsconfig- , configurationbuiltinConfig- , built-in configuration like access token- Returns:
- Throws:
IOExceptionInterruptedExceptionReasoningExceptionSemReasonerException
-
retrieveJsons
public ResultEnumerator retrieveJsons(String ooquery, Configuration config, Properties builtinConfig) throws ReasoningException, InterruptedException, IOException, SemReasonerException Retrieve JSON Objects using an OO-logic query.
The conditions must contain
conditions on the properties to select the objects.
Json objects are retrieved only; no derived Json objects are returned
As variable for the instances of the class ?Id is used.
e.g. ?- ?Id:Person, ?Id[name:?Y,age:?Z], ?Y="Kevin",?Z>20. The Json Objects may be found in variable ?JsonText- Parameters:
ooquery- , OO-logic query to filter the objectsconfig- , configurationbuiltinConfig- , built-in configuration like access token- Returns:
- Throws:
IOExceptionInterruptedExceptionReasoningExceptionSemReasonerException
-
retrieveJsons
public ResultEnumerator retrieveJsons(String ooquery, int maxNumberOfResults, Configuration config, Properties builtinConfig) throws ReasoningException, InterruptedException, IOException, SemReasonerException Retrieve JSON Objects using an OO-logic query.
The conditions must contain
conditions on the properties to select the objects.
Json objects are retrieved only; no derived Json objects are returned
As variable for the instances of the class ?Id is used.
e.g. ?- ?Id:Person, ?Id[name:?Y,age:?Z], ?Y="Kevin",?Z>20. The Json Objects may be found in variable ?JsonText- Parameters:
ooquery- , OO-logic query to filter the objectsconfig- , configurationbuiltinConfig- , built-in configuration like access tokenmaxNumberOfResults- , restrict number of results to that number- Returns:
- Throws:
IOExceptionInterruptedExceptionReasoningExceptionSemReasonerException
-
retrieveTuples
public List<org.json.JSONObject> retrieveTuples(String query, Configuration config, Properties builtinConfig) throws IOException, SemReasonerException, InterruptedException Retrieve tuples (variable substitutions) for a given query
E.g. query ?- ?Id:Person, ?Id[name:?Y,age:?Z], ?Y="Kevin",?Z>20
A result tuple then looks like:
{"Id": "person1", "Y":"Kevin", "Z":23}- Parameters:
query-config- , configurationbuiltinConfig- , built-in configuration like access token- Returns:
- Throws:
SimpleParseExceptionIOExceptionReasoningExceptionInterruptedExceptionSemReasonerException
-
queryJsonObjects
public List<org.json.JSONObject> queryJsonObjects(Collection<String> identifiers, Object module, Configuration config, Properties builtinConfig) throws ReasoningException, InterruptedException, IOException, InstantiationException, IllegalAccessException, SemReasonerException query JSON objects using the json identifiers (@id) in module
Json objects can be derived- Parameters:
identifiers- , identifiers of the json objectsmodule- , the modulebuiltinConfig- , built-in configuration like access token- Returns:
- Throws:
IOExceptionInterruptedExceptionReasoningExceptionIllegalAccessExceptionInstantiationExceptionSemReasonerException
-
queryJsonObjects
public List<org.json.JSONObject> queryJsonObjects(Collection<String> identifiers) throws ReasoningException, InterruptedException, IOException, InstantiationException, IllegalAccessException, SemReasonerException query JSON objects using the json identifiers (@id) in module
Json objects can be derived- Parameters:
identifiers- , identifiers of the json objects- Returns:
- Throws:
IOExceptionInterruptedExceptionReasoningExceptionIllegalAccessExceptionInstantiationExceptionSemReasonerException
-
queryJsonObjects
public List<org.json.JSONObject> queryJsonObjects(Collection<String> identifiers, Configuration config, Properties builtinConfig) throws ReasoningException, InterruptedException, IOException, InstantiationException, IllegalAccessException, SemReasonerException query JSON objects using the json identifiers (@id) in module
Json objects can be derived- Parameters:
identifiers- , identifiers of the json objectsconfig- , configurationbuiltinConfig- , configuration for built-ins like access tokens- Returns:
- Throws:
IOExceptionInterruptedExceptionReasoningExceptionIllegalAccessExceptionInstantiationExceptionSemReasonerException
-
retrieveJsonObjects
public List<org.json.JSONObject> retrieveJsonObjects(Collection<String> identifiers) throws ReasoningException, InterruptedException, IOException, SemReasonerException retrieve JSON objects using the json identifiers (@id)- Parameters:
identifiers- , identifiers of the json objects- Returns:
- Throws:
IOExceptionInterruptedExceptionReasoningExceptionSemReasonerException
-
retrieveJsonObjects
public List<org.json.JSONObject> retrieveJsonObjects(Collection<String> identifiers, boolean initializeTransaction, Properties builtinConfig) throws ReasoningException, InterruptedException, IOException, SemReasonerException retrieve JSON objects using the json identifiers (@id)- Parameters:
identifiers- , identifiers of the json objectsinitializeTransaction- used to mark whether a new transaction should be started and rolled back afterwards- Returns:
- Throws:
IOExceptionInterruptedExceptionReasoningExceptionSemReasonerException
-
retrieveJsonObjects
public List<org.json.JSONObject> retrieveJsonObjects(Collection<String> identifiers, boolean initializeTransaction) throws ReasoningException, InterruptedException, IOException, SemReasonerException retrieve JSON objects using the json identifiers (@id)- Parameters:
identifiers- , identifiers of the json objectsinitializeTransaction- used to mark whether a new transaction should be started and rolled back afterwards- Returns:
- Throws:
IOExceptionInterruptedExceptionReasoningExceptionSemReasonerException
-
retrieveJsonObjects
public List<org.json.JSONObject> retrieveJsonObjects(Collection<String> identifiers, Configuration config, Properties builtinConfig) throws ReasoningException, InterruptedException, IOException, SemReasonerException retrieve JSON objects using the json identifiers (@id)- Parameters:
identifiers- , identifiers of the json objectsbuiltinConfig- , configuration for built-in like access token- Returns:
- Throws:
IOExceptionInterruptedExceptionReasoningExceptionSemReasonerException
-
retrieveJsonObjects
public List<org.json.JSONObject> retrieveJsonObjects(Collection<String> identifiers, Configuration config, Properties builtinConfig, boolean initializeTransaction) throws ReasoningException, InterruptedException, IOException, SemReasonerException retrieve JSON objects using the json identifiers (@id)- Parameters:
identifiers- , identifiers of the json objectsbuiltinConfig- , configuration for built-in like access tokeninitializeTransaction- used to mark whether a new transaction should be started and rolled back afterwards- Returns:
- Throws:
IOExceptionInterruptedExceptionReasoningExceptionSemReasonerException
-
retrieveJsonObject
public org.json.JSONObject retrieveJsonObject(String identifier, Configuration config, Properties builtinConfig) throws ReasoningException, InterruptedException, IOException, SemReasonerException retrieve JSON object using the json identifier (@id)- Parameters:
identifier- , identifier of the json objectbuiltinConfig- , configuration for built-in like access token- Returns:
- Throws:
IOExceptionInterruptedExceptionReasoningExceptionSemReasonerException
-
removeJsonObjects
public boolean removeJsonObjects(Collection<String> identifiers, String module, Configuration config, Properties builtinConfig) throws ReasoningException, InterruptedException, IOException, SemReasonerException Json objects with given ids (@id) are deleted- Parameters:
identifiers-module- , the moduleconfig- , configurationbuiltinConfig- , configuration for built-ins like access tokens- Returns:
- Throws:
ReasoningExceptionInterruptedExceptionIOExceptionSemReasonerException
-
removeJsonObjects
public boolean removeJsonObjects(Collection<String> identifiers, Configuration config, Properties builtinConfig) throws ReasoningException, InterruptedException, IOException, SemReasonerException Json objects with given ids (@id) are deleted- Parameters:
identifiers-config- , configurationbuiltinConfig- , configuration for built-ins like access tokens- Returns:
- Throws:
ReasoningExceptionInterruptedExceptionIOExceptionSemReasonerException
-
removeJsonObjects
public boolean removeJsonObjects(Collection<String> identifiers) throws ReasoningException, InterruptedException, IOException, SemReasonerException Json objects with given ids (@id) are deleted- Parameters:
identifiers-- Returns:
- Throws:
ReasoningExceptionInterruptedExceptionIOExceptionSemReasonerException
-
removeJsonObject
public boolean removeJsonObject(String identifier) throws ReasoningException, InterruptedException, IOException, SemReasonerException Json object with given id (@id) is deleted- Parameters:
identifier-- Returns:
- Throws:
ReasoningExceptionInterruptedExceptionIOExceptionSemReasonerException
-
removeJsonObject
public boolean removeJsonObject(String identifier, Configuration config, Properties builtinConfig) throws ReasoningException, InterruptedException, IOException, SemReasonerException Json object with given id (@id) is deleted- Parameters:
identifier-config- , configurationbuiltinConfig- , configuration for built-ins like access tokens- Returns:
- Throws:
ReasoningExceptionInterruptedExceptionIOExceptionSemReasonerException
-
validateJsonObjects
public boolean validateJsonObjects(List<org.json.JSONObject> jsons, String schemaid) throws InstantiationException, IllegalAccessException, ReasoningException, InterruptedException, IOException, SemReasonerException Validate json objects against a stored schema with @id "schema".
Returns true if the schema was available and it has been successfully validated.
Returns false if there was no schema throws a SemReasonerException if validation failed- Parameters:
jsons- , list of jsons to be validatedschemaid- , id of a stored json schema- Returns:
- has schema been there
- Throws:
InstantiationExceptionIllegalAccessExceptionReasoningExceptionInterruptedExceptionIOExceptionSemReasonerException
-
validateJsonObjects
public boolean validateJsonObjects(List<org.json.JSONObject> jsons, String schemaid, Configuration config, Properties builtinConfig) throws InstantiationException, IllegalAccessException, ReasoningException, InterruptedException, IOException, SemReasonerException Validate json objects against a stored schema with @id "schema".
Returns true if the schema was available and it has been successfully validated.
Returns false if there was no schema throws a SemReasonerException if validation failed- Parameters:
jsons- , list of jsons to be validatedschemaid- , id of a stored json schemaconfig- , configurationconfig- , configurationbuiltinConfig- , built-in configuration like access token- Returns:
- has schema been there
- Throws:
InstantiationExceptionIllegalAccessExceptionReasoningExceptionInterruptedExceptionIOExceptionSemReasonerException
-
validateJsonObjects
public void validateJsonObjects(List<org.json.JSONObject> jsons, org.json.JSONObject schema, Properties builtinConfig) throws InstantiationException, IllegalAccessException, ReasoningException, InterruptedException, IOException, SemReasonerException Validate json objects against a schema.
Throws a SemReasonerException if validation failed- Parameters:
jsons- , list of jsons to be validatedschema- , json object containing the schemabuiltinConfig- , built-in configuration like access token- Throws:
InstantiationExceptionIllegalAccessExceptionReasoningExceptionInterruptedExceptionIOExceptionSemReasonerException
-
transactionBegin
start a transaction- Throws:
SemReasonerExceptionIOException
-
transactionRollback
rollback transaction -
transactionCommit
commit transaction -
getAvailableIdentifiers
public List<String> getAvailableIdentifiers(List<String> identifiers, Configuration config, Properties builtinConfig) throws SemReasonerException, IOException, ReasoningException, InterruptedException Which of the given json identifiers are there?- Parameters:
identifiers- to be checkedconfig- , configurationbuiltinConfig- , configuration for built-ins like access tokens- Returns:
- Throws:
SemReasonerExceptionIOExceptionReasoningExceptionInterruptedException
-
getAvailableIdentifiers
public List<String> getAvailableIdentifiers(List<String> identifiers) throws SemReasonerException, IOException, ReasoningException, InterruptedException Which of the given json identifiers are there?- Parameters:
identifiers- to be checked- Returns:
- Throws:
SemReasonerExceptionIOExceptionReasoningExceptionInterruptedException
-
getAvailableIdentifiers
public List<String> getAvailableIdentifiers(List<String> identifiers, String module, Configuration config, Properties builtinConfig) throws SemReasonerException, IOException, ReasoningException, InterruptedException Which of the given json identifiers are there?- Parameters:
identifiers- to be checkedmodule- , the moduleconfig- , configurationbuiltinConfig- , built-in configuration like access token- Returns:
- Throws:
SemReasonerExceptionIOExceptionReasoningExceptionInterruptedException
-
isIdentifierAvailable
public boolean isIdentifierAvailable(String identifier, String module, Configuration config, Properties builtinConfig) throws SemReasonerException, IOException, ReasoningException, InterruptedException Is this identifier for a json object there?- Parameters:
identifier- to be checkedmodule-config- , configurationbuiltinConfig- , built-in configuration like access token- Returns:
- Throws:
SemReasonerExceptionIOExceptionReasoningExceptionInterruptedException
-
isIdentifierAvailable
public boolean isIdentifierAvailable(String identifier) throws SemReasonerException, IOException, ReasoningException, InterruptedException Is this identifier for a json object there?- Parameters:
identifier- to be checked- Returns:
- Throws:
SemReasonerExceptionIOExceptionReasoningExceptionInterruptedException
-
isIdentifierAvailable
public boolean isIdentifierAvailable(String identifier, Configuration config, Properties builtinConfig) throws SemReasonerException, IOException, ReasoningException, InterruptedException Is this identifier for a json object there?- Parameters:
identifier- to be checkedconfig- , configurationbuiltinConfig- , built-in configuration like access token- Returns:
- Throws:
SemReasonerExceptionIOExceptionReasoningExceptionInterruptedException
-
exportJson
public void exportJson(String path, Set<String> excludedProperties) throws IOException, SemReasonerException, InterruptedException, ReasoningException Export jsons into file- Parameters:
path- , path of fileexcludedProperties- , properties excluded from export, null if not needed- Throws:
IOExceptionSemReasonerExceptionInterruptedExceptionReasoningException
-
loadByStream
public void loadByStream(InputStream in, InputStream companionstream, String format) throws FileNotFoundException, IOException, EDBException, SemReasonerException, SymboltableException, InterruptedException load facts by stream.
format is either the file format like json,nq etc.
In case of raw it is the predicate like value|3
companion stream contains additional information, e.g. schema information in case of csv- Parameters:
in- , input stream for datacompanionstream- , input stream for companion data, e.g. header info and data formats for csv filesformat-- Throws:
UnsupportedEncodingExceptionIOExceptionSemReasonerExceptionInterruptedExceptionFileNotFoundExceptionEDBExceptionSymboltableException
-
load
public void load(String path) throws FileNotFoundException, IOException, EDBException, SemReasonerException, InterruptedException, SymboltableException Import from a json files- Parameters:
path- , the file path- Throws:
FileNotFoundExceptionIOExceptionEDBExceptionSemReasonerExceptionInterruptedExceptionSymboltableException
-
load
public void load(List<String> paths) throws FileNotFoundException, IOException, EDBException, SemReasonerException, InterruptedException, SymboltableException Import from a list of json files- Parameters:
paths- , the file paths- Throws:
FileNotFoundExceptionIOExceptionEDBExceptionSemReasonerExceptionInterruptedExceptionSymboltableException
-
getDeductiveDatabase
Returns the deductive database which is used inside the JSONDeductiveDatabase.- Returns:
- deductive database
-