Package org.hobbit.storage.queries
Class SparqlQueries
- java.lang.Object
-
- org.hobbit.storage.queries.SparqlQueries
-
public class SparqlQueries extends Object
This class provides static SPRAQL queries that are loaded from predefined resources.- Author:
- Michael Röder (roeder@informatik.uni-leipzig.de)
-
-
Field Summary
Fields Modifier and Type Field Description private static StringANALYSIS_RESULT_SET_PLACEHOLDERprivate static StringBENCHMARK_PLACEHOLDERprivate static StringCHALLENGE_PLACEHOLDERprivate static StringCHALLENGE_TASK_PLACEHOLDERprivate static String[]CLEAN_UP_CHALLENGE_GRAPH_QUERIESAn update query that cleans up the graph of containing challenges.private static StringCLEAN_UP_CHALLENGE_GRAPH_QUERYDeprecated.private static String[]CLEAN_UP_PRIVATE_GRAPH_QUERIESAn update query that cleans up the graph of containing challenges.private static StringCLOSE_CHALLENGE_UPDATE_QUERYAn update query that closes a challenge.private static StringCOUNT_EXP_OF_TASK_QUERYA select query for counting the number of experiments of a challenge task.private static StringCREATE_EXPERIMENT_FROM_CHALLENGE_TASKA construct query that selects the subgraph of a challenge task that defines an experiment of this task.private static StringDATE_OF_NEXT_EXECUTION_UPDATE_QUERYAn update query that changes next execution date for a repeatable challenge.private static intDEFAULT_MAX_UPDATE_QUERY_TRIPLESDefault value of the maximum triples a single update query should have.private static StringDELETE_ANALYSIS_RESULTSA construct query for getting the analysis results of all systems for a certain benchmark.private static StringDELETE_CHALLENGE_GRAPH_QUERYAn update query that deletes the graph of a challenge.private static StringDELETE_EXPERIMENT_GRAPH_QUERYAn update query that deletes the graph of an experiment.private static org.apache.jena.rdf.model.ModelEMPTY_MODELAn empty RDF model instance.private static StringEXPERIMENT_PLACEHOLDERprivate static StringEXPERIMENT_SELECTIONprivate static StringGET_ANALYSIS_RESULTS_OF_BENCHMARKA construct query for getting the analysis results of all systems for a certain benchmark.private static StringGET_CHALLENGE_GRAPH_QUERYA construct query that retrieves the graph of a challenge.private static StringGET_CHALLENGE_PUBLISH_INFO_QUERYA construct query that retrieves the graph of a challenge.private static StringGET_CHALLENGE_TASK_ORGANIZERA construct query for getting the organizer of the challenge two which a given challenge tasks belong to.private static StringGET_CHALLENGE_TASKS_QUERYA construct query that retrieves the tasks of a challenge.private static StringGET_EXPERIMENT_OF_BENCHMARK_QUERYA construct query that selects the graph of an experiment that is part of a given challenge task.private static StringGET_EXPERIMENT_OF_TASK_QUERYA construct query that selects the graph of an experiment that is part of a given challenge task.private static StringGET_EXPERIMENT_QUERYA construct query that selects the graph of an experiment.private static StringGET_LICENSE_OF_DATASETA construct query for getting the licensing data of the specified dataset.private static StringGET_REPEATABLE_CHALLENGE_INFO_QUERYA construct query that retrieves the graph of a repeatable challenge.private static StringGET_SHALLOW_CHALLENGE_GRAPH_QUERYA construct query that retrieves a shallow of a challenge.private static StringGET_SHALLOW_EXPERIMENT_QUERYA construct query that selects a shallow graph of an experiment.private static StringGRAPH_PLACEHOLDERprivate static org.slf4j.LoggerLOGGERprivate static StringMOVE_CHALLENGE_SYSTEM_QUERYAn update query that moves involvesSystem triples between graphs.private static StringNEW_GRAPH_PLACEHOLDERprivate static StringSYSTEM_PLACEHOLDERprivate static StringVALUE_PLACEHOLDER
-
Constructor Summary
Constructors Constructor Description SparqlQueries()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static String[]cleanUpChallengeGraphQueries(String graphUri)Returns a SPARQL update query for cleaning up the graph of a challenge configs.static StringcleanUpChallengeGraphQuery(String graphUri)Deprecated.A single large query does not seem to be supported by all triple stores.static String[]cleanUpPrivateGraphQueries(String graphUri)Returns a SPARQL update query for cleaning up the private result graph.static StringcountExperimentsOfTaskQuery(String challengeTaskUri, String graphUri)Returns a SPARQL query for counting the number of experiments of a challenge task.static StringdeleteAnalysisResults(String analysisResultSetUri, String graphUri)Returns a SPARQL DELETE query for removing the analysis results set with the given URI.static StringdeleteChallengeGraphQuery(String challengeUri, String graphUri)Returns a SPARQL update query for deleting the graph of a challenge.static StringdeleteExperimentGraphQuery(String experimentUri, String graphUri)Returns a SPARQL update query for deleting the graph of an experiment.private static StringextendQuery(String query, String target, String extension)Extends a SPARQL query by inserting specified extension string every time a target string is found.static StringgetAnalysisResultsOfBenchmark(String benchmarkUri, String graphUri)Returns a SPARQL CONSTRUCT query for getting the analysis results of all systems for a certain benchmark.static StringgetChallengeGraphQuery(String challengeUri, String graphUri)Returns a SPARQL query for retrieving the graph of a challenge.static StringgetChallengePublishInfoQuery(String challengeUri, String graphUri)Returns a SPARQL query for retrieving a graph comprising the task URIs and the publication date of a challenge if this challenge is closed.static StringgetChallengeTaskOrganizer(String challengeTaskUri, String graphUri)Returns a SPARQL CONSTRUCT query for getting the organizer of the challenge two which a given challenge tasks belong to.static StringgetChallengeTasksQuery(String challengeUri, String graphUri)Returns a SPARQL query for retrieving the tasks of a challenge.static StringgetCloseChallengeQuery(String challengeUri, String graphUri)Returns a SPARQL query for adding the closed triple to the challenge with the given URI.static StringgetCreateExperimentFromTaskQuery(String experimentUri, String challengeTaskUri, String systemUri, String graphUri)Returns a SPARQL query for creating a subgraph of a challenge task that defines an experiment of this task.static StringgetExperimentGraphOfBenchmarkQuery(String benchmarkUri, String graphUri)Returns a SPARQL query for retrieving the graphs of experiments that involve the given benchmark.static StringgetExperimentGraphOfBenchmarksQuery(List<String> benchmarkUris, String graphUri)Returns a SPARQL query for retrieving the graphs of experiments that involve one of the given benchmarks.static StringgetExperimentGraphOfSystemsQuery(List<String> systemUris, String graphUri)Returns a SPARQL query for retrieving the graphs of experiments that involve one of the given systems.static StringgetExperimentGraphQuery(String experimentUri, String graphUri)Returns a SPARQL query for retrieving the graph of an experiment.static StringgetExperimentOfTaskQuery(String experimentUri, String challengeTaskUri, String graphUri)Returns a SPARQL query for retrieving the graph of an experiment that is part of the given challenge task.static StringgetLicenseOfDataset(String graphUri)Returns a SPARQL CONSTRUCT query for getting the analysis results of all systems for a certain benchmark.static StringgetMoveChallengeSystemQuery(String challengeUri, String graphUri, String newGraphUri)Returns a SPARQL query for moving involvesSystem triples between graphs for a challenge with given URI.static StringgetRepeatableChallengeInfoQuery(String challengeUri, String graphUri)Returns a SPARQL query for retrieving a graph comprising repeatable challenge properties if this challenge is closed.static StringgetShallowChallengeGraphQuery(String challengeUri, String graphUri)Returns a SPARQL query for retrieving a shallow graph of a challenge.static StringgetShallowExperimentGraphQuery(String experimentUri, String graphUri)Returns a SPARQL query for retrieving a shallow graph of an experiment containing the links to the system instance, the benchmark and the challenge task and the labels of them.static StringgetUpdateDateOfNextExecutionQuery(String challengeUri, Calendar newValue, String graphUri)Returns a SPARQL query for updating the date of next execution for a repeatable challenge with given URI.static String[]getUpdateQueriesFromDiff(org.apache.jena.rdf.model.Model original, org.apache.jena.rdf.model.Model updated, String graphUri)Generates one or several SPARQL UPDATE queries based on the differences between the two given models.static String[]getUpdateQueriesFromDiff(org.apache.jena.rdf.model.Model original, org.apache.jena.rdf.model.Model updated, String graphUri, int maxTriplesPerQuery)Generates one or several SPARQL UPDATE queries based on the differences between the two given models.static StringgetUpdateQueryFromDiff(org.apache.jena.rdf.model.Model original, org.apache.jena.rdf.model.Model updated, String graphUri)Generates a SPARQL UPDATE query based on the differences between the two given models.static StringgetUpdateQueryFromStatements(List<org.apache.jena.rdf.model.Statement> deleted, List<org.apache.jena.rdf.model.Statement> inserted, org.apache.jena.shared.PrefixMapping mapping, String graphUri)Generates a SPARQL UPDATE query based on the given list of statements that should be deleted and that should be added in the graph with the given URI.private static StringloadQuery(String resourceName)Loads the given resource, e.g., a SPARQL query, as String.private static StringreplacePlaceholders(String query, String[] placeholders, String[] replacements)Replaces the given placeholders in the given query with the given replacements.
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
ANALYSIS_RESULT_SET_PLACEHOLDER
private static final String ANALYSIS_RESULT_SET_PLACEHOLDER
- See Also:
- Constant Field Values
-
BENCHMARK_PLACEHOLDER
private static final String BENCHMARK_PLACEHOLDER
- See Also:
- Constant Field Values
-
CHALLENGE_PLACEHOLDER
private static final String CHALLENGE_PLACEHOLDER
- See Also:
- Constant Field Values
-
CHALLENGE_TASK_PLACEHOLDER
private static final String CHALLENGE_TASK_PLACEHOLDER
- See Also:
- Constant Field Values
-
EXPERIMENT_PLACEHOLDER
private static final String EXPERIMENT_PLACEHOLDER
- See Also:
- Constant Field Values
-
GRAPH_PLACEHOLDER
private static final String GRAPH_PLACEHOLDER
- See Also:
- Constant Field Values
-
NEW_GRAPH_PLACEHOLDER
private static final String NEW_GRAPH_PLACEHOLDER
- See Also:
- Constant Field Values
-
SYSTEM_PLACEHOLDER
private static final String SYSTEM_PLACEHOLDER
- See Also:
- Constant Field Values
-
VALUE_PLACEHOLDER
private static final String VALUE_PLACEHOLDER
- See Also:
- Constant Field Values
-
DEFAULT_MAX_UPDATE_QUERY_TRIPLES
private static final int DEFAULT_MAX_UPDATE_QUERY_TRIPLES
Default value of the maximum triples a single update query should have.- See Also:
- Constant Field Values
-
EMPTY_MODEL
private static final org.apache.jena.rdf.model.Model EMPTY_MODEL
An empty RDF model instance.
-
EXPERIMENT_SELECTION
private static final String EXPERIMENT_SELECTION
- See Also:
- Constant Field Values
-
GET_LICENSE_OF_DATASET
private static final String GET_LICENSE_OF_DATASET
A construct query for getting the licensing data of the specified dataset.
-
GET_ANALYSIS_RESULTS_OF_BENCHMARK
private static final String GET_ANALYSIS_RESULTS_OF_BENCHMARK
A construct query for getting the analysis results of all systems for a certain benchmark.
-
DELETE_ANALYSIS_RESULTS
private static final String DELETE_ANALYSIS_RESULTS
A construct query for getting the analysis results of all systems for a certain benchmark.
-
GET_CHALLENGE_GRAPH_QUERY
private static final String GET_CHALLENGE_GRAPH_QUERY
A construct query that retrieves the graph of a challenge.
-
GET_SHALLOW_CHALLENGE_GRAPH_QUERY
private static final String GET_SHALLOW_CHALLENGE_GRAPH_QUERY
A construct query that retrieves a shallow of a challenge.
-
GET_CHALLENGE_TASKS_QUERY
private static final String GET_CHALLENGE_TASKS_QUERY
A construct query that retrieves the tasks of a challenge.
-
GET_CHALLENGE_PUBLISH_INFO_QUERY
private static final String GET_CHALLENGE_PUBLISH_INFO_QUERY
A construct query that retrieves the graph of a challenge.
-
GET_REPEATABLE_CHALLENGE_INFO_QUERY
private static final String GET_REPEATABLE_CHALLENGE_INFO_QUERY
A construct query that retrieves the graph of a repeatable challenge.
-
CLOSE_CHALLENGE_UPDATE_QUERY
private static final String CLOSE_CHALLENGE_UPDATE_QUERY
An update query that closes a challenge.
-
DATE_OF_NEXT_EXECUTION_UPDATE_QUERY
private static final String DATE_OF_NEXT_EXECUTION_UPDATE_QUERY
An update query that changes next execution date for a repeatable challenge.
-
MOVE_CHALLENGE_SYSTEM_QUERY
private static final String MOVE_CHALLENGE_SYSTEM_QUERY
An update query that moves involvesSystem triples between graphs.
-
GET_EXPERIMENT_QUERY
private static final String GET_EXPERIMENT_QUERY
A construct query that selects the graph of an experiment.
-
GET_SHALLOW_EXPERIMENT_QUERY
private static final String GET_SHALLOW_EXPERIMENT_QUERY
A construct query that selects a shallow graph of an experiment.
-
GET_EXPERIMENT_OF_BENCHMARK_QUERY
private static final String GET_EXPERIMENT_OF_BENCHMARK_QUERY
A construct query that selects the graph of an experiment that is part of a given challenge task.
-
GET_EXPERIMENT_OF_TASK_QUERY
private static final String GET_EXPERIMENT_OF_TASK_QUERY
A construct query that selects the graph of an experiment that is part of a given challenge task.
-
CREATE_EXPERIMENT_FROM_CHALLENGE_TASK
private static final String CREATE_EXPERIMENT_FROM_CHALLENGE_TASK
A construct query that selects the subgraph of a challenge task that defines an experiment of this task.
-
DELETE_EXPERIMENT_GRAPH_QUERY
private static final String DELETE_EXPERIMENT_GRAPH_QUERY
An update query that deletes the graph of an experiment.
-
DELETE_CHALLENGE_GRAPH_QUERY
private static final String DELETE_CHALLENGE_GRAPH_QUERY
An update query that deletes the graph of a challenge.
-
CLEAN_UP_CHALLENGE_GRAPH_QUERY
@Deprecated private static final String CLEAN_UP_CHALLENGE_GRAPH_QUERY
Deprecated.An update query that cleans up the graph of containing challenges.
-
CLEAN_UP_CHALLENGE_GRAPH_QUERIES
private static final String[] CLEAN_UP_CHALLENGE_GRAPH_QUERIES
An update query that cleans up the graph of containing challenges.
-
CLEAN_UP_PRIVATE_GRAPH_QUERIES
private static final String[] CLEAN_UP_PRIVATE_GRAPH_QUERIES
An update query that cleans up the graph of containing challenges.
-
COUNT_EXP_OF_TASK_QUERY
private static final String COUNT_EXP_OF_TASK_QUERY
A select query for counting the number of experiments of a challenge task.
-
GET_CHALLENGE_TASK_ORGANIZER
private static final String GET_CHALLENGE_TASK_ORGANIZER
A construct query for getting the organizer of the challenge two which a given challenge tasks belong to.
-
-
Method Detail
-
loadQuery
private static final String loadQuery(String resourceName)
Loads the given resource, e.g., a SPARQL query, as String.- Parameters:
resourceName- name of the resource that should be loaded- Returns:
- the resource as String or
nullif an error occurs
-
getLicenseOfDataset
public static final String getLicenseOfDataset(String graphUri)
Returns a SPARQL CONSTRUCT query for getting the analysis results of all systems for a certain benchmark.- Parameters:
benchmarkUri- URI of the benchmarkgraphUri- URI of the graph the experiment is stored.nullworks like a wildcard.- Returns:
- the SPARQL CONSTRUCT query that performs the retrieving or
nullif the query hasn't been loaded correctly
-
getAnalysisResultsOfBenchmark
public static final String getAnalysisResultsOfBenchmark(String benchmarkUri, String graphUri)
Returns a SPARQL CONSTRUCT query for getting the analysis results of all systems for a certain benchmark.- Parameters:
benchmarkUri- URI of the benchmarkgraphUri- URI of the graph the experiment is stored.nullworks like a wildcard.- Returns:
- the SPARQL CONSTRUCT query that performs the retrieving or
nullif the query hasn't been loaded correctly
-
deleteAnalysisResults
public static final String deleteAnalysisResults(String analysisResultSetUri, String graphUri)
Returns a SPARQL DELETE query for removing the analysis results set with the given URI.- Parameters:
analysisResultSetUri- URI of the analysis result set which should be removedgraphUri- URI of the graph the analysis result set is stored.- Returns:
- the SPARQL DELETE query that performs the removal or
nullif the query hasn't been loaded correctly
-
getChallengeGraphQuery
public static final String getChallengeGraphQuery(String challengeUri, String graphUri)
Returns a SPARQL query for retrieving the graph of a challenge.- Parameters:
challengeUri- URI of the challenge that should be retrieved.nullworks like a wildcard.graphUri- URI of the graph the challenge is stored.nullworks like a wildcard.- Returns:
- the SPARQL construct query that performs the retrieving or
nullif the query hasn't been loaded correctly
-
getShallowChallengeGraphQuery
public static final String getShallowChallengeGraphQuery(String challengeUri, String graphUri)
Returns a SPARQL query for retrieving a shallow graph of a challenge.- Parameters:
challengeUri- URI of the challenge that should be retrieved.nullworks like a wildcard.graphUri- URI of the graph the challenge is stored.nullworks like a wildcard.- Returns:
- the SPARQL construct query that performs the retrieving or
nullif the query hasn't been loaded correctly
-
getChallengeTasksQuery
public static final String getChallengeTasksQuery(String challengeUri, String graphUri)
Returns a SPARQL query for retrieving the tasks of a challenge.- Parameters:
challengeUri- URI of the challenge that should be retrieved.nullworks like a wildcard.graphUri- URI of the graph the challenge is stored.nullworks like a wildcard.- Returns:
- the SPARQL construct query that performs the retrieving or
nullif the query hasn't been loaded correctly
-
getChallengePublishInfoQuery
public static final String getChallengePublishInfoQuery(String challengeUri, String graphUri)
Returns a SPARQL query for retrieving a graph comprising the task URIs and the publication date of a challenge if this challenge is closed.- Parameters:
challengeUri- URI of the challenge that should be retrieved.nullworks like a wildcard.graphUri- URI of the graph the challenge is stored.nullworks like a wildcard.- Returns:
- the SPARQL construct query that performs the retrieving or
nullif the query hasn't been loaded correctly
-
getRepeatableChallengeInfoQuery
public static final String getRepeatableChallengeInfoQuery(String challengeUri, String graphUri)
Returns a SPARQL query for retrieving a graph comprising repeatable challenge properties if this challenge is closed.- Parameters:
challengeUri- URI of the challenge that should be retrieved.nullworks like a wildcard.graphUri- URI of the graph the challenge is stored.nullworks like a wildcard.- Returns:
- the SPARQL construct query that performs the retrieving or
nullif the query hasn't been loaded correctly
-
getCloseChallengeQuery
public static final String getCloseChallengeQuery(String challengeUri, String graphUri)
Returns a SPARQL query for adding the closed triple to the challenge with the given URI.- Parameters:
challengeUri- URI of the challenge that should be closed.nullworks like a wildcard.graphUri- URI of the graph the challenge is stored.nullworks like a wildcard.- Returns:
- the SPARQL update query that performs the insertion or
nullif the query hasn't been loaded correctly
-
getUpdateDateOfNextExecutionQuery
public static final String getUpdateDateOfNextExecutionQuery(String challengeUri, Calendar newValue, String graphUri)
Returns a SPARQL query for updating the date of next execution for a repeatable challenge with given URI.- Parameters:
challengeUri- URI of the challenge that should be updated.nullworks like a wildcard.newValue- New value for date of next execution.nullto remove the value.graphUri- URI of the graph the challenge is stored.nullworks like a wildcard.- Returns:
- the SPARQL update query that performs the insertion or
nullif the query hasn't been loaded correctly
-
getMoveChallengeSystemQuery
public static final String getMoveChallengeSystemQuery(String challengeUri, String graphUri, String newGraphUri)
Returns a SPARQL query for moving involvesSystem triples between graphs for a challenge with given URI.- Parameters:
challengeUri- URI of the challenge that should be updated.nullworks like a wildcard.graphUri- URI of the challenge definition graph.newGraphUri- URI of the public data graph.- Returns:
- the SPARQL update query that performs the operation or
nullif the query hasn't been loaded correctly
-
getExperimentGraphQuery
public static final String getExperimentGraphQuery(String experimentUri, String graphUri)
Returns a SPARQL query for retrieving the graph of an experiment.- Parameters:
experimentUri- URI of the experiment that should be retrieved.nullworks like a wildcard.graphUri- URI of the graph the experiment is stored.nullworks like a wildcard.- Returns:
- the SPARQL construct query that performs the retrieving or
nullif the query hasn't been loaded correctly
-
getShallowExperimentGraphQuery
public static final String getShallowExperimentGraphQuery(String experimentUri, String graphUri)
Returns a SPARQL query for retrieving a shallow graph of an experiment containing the links to the system instance, the benchmark and the challenge task and the labels of them.- Parameters:
experimentUri- URI of the experiment that should be retrieved.nullworks like a wildcard.graphUri- URI of the graph the experiment is stored.nullworks like a wildcard.- Returns:
- the SPARQL construct query that performs the retrieving or
nullif the query hasn't been loaded correctly
-
extendQuery
private static final String extendQuery(String query, String target, String extension)
Extends a SPARQL query by inserting specified extension string every time a target string is found.- Parameters:
query- The original query.target- Target string to find.extension- Extension string to insert.- Returns:
- the modified query or
nullif the query is invalid.
-
getExperimentGraphOfBenchmarksQuery
public static final String getExperimentGraphOfBenchmarksQuery(List<String> benchmarkUris, String graphUri)
Returns a SPARQL query for retrieving the graphs of experiments that involve one of the given benchmarks.- Parameters:
benchmarkUris- URIs of the benchmarks that might be involved in the experiment.graphUri- URI of the graph the experiment is stored.nullworks like a wildcard.- Returns:
- the SPARQL construct query that performs the retrieving or
nullif the query hasn't been loaded correctly
-
getExperimentGraphOfSystemsQuery
public static final String getExperimentGraphOfSystemsQuery(List<String> systemUris, String graphUri)
Returns a SPARQL query for retrieving the graphs of experiments that involve one of the given systems.- Parameters:
systemUris- URIs of the systems that might be involved in the experiment.graphUri- URI of the graph the experiment is stored.nullworks like a wildcard.- Returns:
- the SPARQL construct query that performs the retrieving or
nullif the query hasn't been loaded correctly
-
getExperimentGraphOfBenchmarkQuery
public static final String getExperimentGraphOfBenchmarkQuery(String benchmarkUri, String graphUri)
Returns a SPARQL query for retrieving the graphs of experiments that involve the given benchmark.- Parameters:
benchmarkUri- URIs of the benchmark that might be involved in the experiment.graphUri- URI of the graph the experiment is stored.nullworks like a wildcard.- Returns:
- the SPARQL construct query that performs the retrieving or
nullif the query hasn't been loaded correctly
-
getExperimentOfTaskQuery
public static final String getExperimentOfTaskQuery(String experimentUri, String challengeTaskUri, String graphUri)
Returns a SPARQL query for retrieving the graph of an experiment that is part of the given challenge task.- Parameters:
experimentUri- URI of the experiment that should be retrieved.nullworks like a wildcard.challengeTaskUri- URI of the challenge task from which the experiment should be created.nullworks like a wildcard.graphUri- URI of the graph the experiment is stored.nullworks like a wildcard.- Returns:
- the SPARQL construct query that performs the retrieving or
nullif the query hasn't been loaded correctly
-
getCreateExperimentFromTaskQuery
public static final String getCreateExperimentFromTaskQuery(String experimentUri, String challengeTaskUri, String systemUri, String graphUri)
Returns a SPARQL query for creating a subgraph of a challenge task that defines an experiment of this task.- Parameters:
experimentUri- URI of the newly created experiment.challengeTaskUri- URI of the challenge task from which the experiment should be created.nullworks like a wildcard.systemUri- URI of the system of the experiment.nullworks like a wildcard.graphUri- URI of the graph the experiment is stored.nullworks like a wildcard.- Returns:
- the SPARQL construct query that performs the retrieving or
nullif the query hasn't been loaded correctly - Throws:
IllegalArgumentException- if the given experimentUri is null
-
deleteExperimentGraphQuery
public static final String deleteExperimentGraphQuery(String experimentUri, String graphUri)
Returns a SPARQL update query for deleting the graph of an experiment.- Parameters:
experimentUri- URI of the experiment that should be retrieved.nullworks like a wildcard.graphUri- URI of the graph the challenge is stored.- Returns:
- the SPARQL update query that performs the deletion or
nullif the query hasn't been loaded correctly
-
deleteChallengeGraphQuery
public static final String deleteChallengeGraphQuery(String challengeUri, String graphUri)
Returns a SPARQL update query for deleting the graph of a challenge.- Parameters:
challengeUri- URI of the challenge that should be retrieved.nullworks like a wildcard.graphUri- URI of the graph the challenge is stored.- Returns:
- the SPARQL update query that performs the deletion or
nullif the query hasn't been loaded correctly
-
cleanUpChallengeGraphQuery
@Deprecated public static final String cleanUpChallengeGraphQuery(String graphUri)
Deprecated.A single large query does not seem to be supported by all triple stores. UsecleanUpChallengeGraphQueries(String)instead.Returns a SPARQL update query for cleaning up the graph of a challenge configs.- Parameters:
graphUri- URI of the graph the challenge is stored.nullworks like a wildcard.- Returns:
- the SPARQL update query that performs the deletion or
nullif the query hasn't been loaded correctly
-
cleanUpChallengeGraphQueries
public static final String[] cleanUpChallengeGraphQueries(String graphUri)
Returns a SPARQL update query for cleaning up the graph of a challenge configs.- Parameters:
graphUri- URI of the challenge configuration graph.- Returns:
- the SPARQL update query that performs the deletion or
nullif the query hasn't been loaded correctly
-
cleanUpPrivateGraphQueries
public static final String[] cleanUpPrivateGraphQueries(String graphUri)
Returns a SPARQL update query for cleaning up the private result graph.- Parameters:
graphUri- URI of the private result graph.- Returns:
- the SPARQL update query that performs the deletion or
nullif the query hasn't been loaded correctly
-
countExperimentsOfTaskQuery
public static final String countExperimentsOfTaskQuery(String challengeTaskUri, String graphUri)
Returns a SPARQL query for counting the number of experiments of a challenge task.- Parameters:
challengeTaskUri- URI of the challenge taskgraphUri- URI of the graph the experiment is stored.nullworks like a wildcard.- Returns:
- the SPARQL select query that performs the retrieving or
nullif the query hasn't been loaded correctly
-
getChallengeTaskOrganizer
public static final String getChallengeTaskOrganizer(String challengeTaskUri, String graphUri)
Returns a SPARQL CONSTRUCT query for getting the organizer of the challenge two which a given challenge tasks belong to.- Parameters:
challengeTaskUri- URI of the challenge taskgraphUri- URI of the graph the experiment is stored.nullworks like a wildcard.- Returns:
- the SPARQL CONSTRUCT query that performs the retrieving or
nullif the query hasn't been loaded correctly
-
replacePlaceholders
private static final String replacePlaceholders(String query, String[] placeholders, String[] replacements)
Replaces the given placeholders in the given query with the given replacements. If a replacement isnull, it is replaced by a variable.- Parameters:
query- the query containing placeholdersplaceholders- the placeholders that should be replacedreplacements- the replacements that should be used to replace the placeholders.- Returns:
- the newly created query or
nullif the given query wasnull.
-
getUpdateQueryFromDiff
public static final String getUpdateQueryFromDiff(org.apache.jena.rdf.model.Model original, org.apache.jena.rdf.model.Model updated, String graphUri)
Generates a SPARQL UPDATE query based on the differences between the two given models. Triples that are present in the original model but not in the updated model will be put into the DELETE part of the query. Triples that are present in the updated model but can not be found in the original model will be put into the INSERT part of the query.Note that some stores might have a maximum number of triples that can be processed with a single query. In these cases
getUpdateQueriesFromDiff(Model, Model, String, int)should be used.- Parameters:
original- the original RDF modelupdated- the updated RDF modelgraphUri- the URI of the graph to which the UPDATE query should be applied ornull- Returns:
- The SPARQL UPDATE query
-
getUpdateQueryFromStatements
public static final String getUpdateQueryFromStatements(List<org.apache.jena.rdf.model.Statement> deleted, List<org.apache.jena.rdf.model.Statement> inserted, org.apache.jena.shared.PrefixMapping mapping, String graphUri)
Generates a SPARQL UPDATE query based on the given list of statements that should be deleted and that should be added in the graph with the given URI.- Parameters:
deleted- statements that should be deleted from the graphinserted- statements that should be added to the graphmapping- A prefix mapping used for the querygraphUri- the URI of the graph which should be updated with the generated query- Returns:
- the update query
-
getUpdateQueriesFromDiff
public static final String[] getUpdateQueriesFromDiff(org.apache.jena.rdf.model.Model original, org.apache.jena.rdf.model.Model updated, String graphUri)
Generates one or several SPARQL UPDATE queries based on the differences between the two given models. Triples that are present in the original model but not in the updated model will be put into the DELETE part of the query. Triples that are present in the updated model but can not be found in the original model will be put into the INSERT part of the query. The changes might be carried out using multiple queries if a single query could hit a maximum number of triples.- Parameters:
original- the original RDF model (nullis interpreted as an empty model)updated- the updated RDF model (nullis interpreted as an empty model)graphUri- the URI of the graph to which the UPDATE query should be applied ornull- Returns:
- The SPARQL UPDATE query
-
getUpdateQueriesFromDiff
public static final String[] getUpdateQueriesFromDiff(org.apache.jena.rdf.model.Model original, org.apache.jena.rdf.model.Model updated, String graphUri, int maxTriplesPerQuery)
Generates one or several SPARQL UPDATE queries based on the differences between the two given models. Triples that are present in the original model but not in the updated model will be put into the DELETE part of the query. Triples that are present in the updated model but can not be found in the original model will be put into the INSERT part of the query. The changes will be carried out using multiple queries if a single query would hit the given maximum number of triples per query.- Parameters:
original- the original RDF model (nullis interpreted as an empty model)updated- the updated RDF model (nullis interpreted as an empty model)graphUri- the URI of the graph to which the UPDATE query should be applied ornullmaxTriplesPerQuery- the maximum number of triples a single query should contain- Returns:
- The SPARQL UPDATE query
-
-