public class SparqlQueries extends Object
| Modifier and Type | Field and Description |
|---|---|
private static String |
CHALLENGE_PLACEHOLDER |
private static String |
CHALLENGE_TASK_PLACEHOLDER |
private static String[] |
CLEAN_UP_CHALLENGE_GRAPH_QUERIES
An update query that cleans up the graph of containing challenges.
|
private static String |
CLEAN_UP_CHALLENGE_GRAPH_QUERY
Deprecated.
|
private static String[] |
CLEAN_UP_PRIVATE_GRAPH_QUERIES
An update query that cleans up the graph of containing challenges.
|
private static String |
CLOSE_CHALLENGE_UPDATE_QUERY
An update query that closes a challenge.
|
private static String |
COUNT_EXP_OF_TASK_QUERY
A select query for counting the number of experiments of a challenge
task.
|
private static String |
CREATE_EXPERIMENT_FROM_CHALLENGE_TASK
A construct query that selects the subgraph of a challenge task that
defines an experiment of this task.
|
private static String |
DATE_OF_NEXT_EXECUTION_UPDATE_QUERY
An update query that changes next execution date for a repeatable challenge.
|
private static int |
DEFAULT_MAX_UPDATE_QUERY_TRIPLES |
private static String |
DELETE_CHALLENGE_GRAPH_QUERY
An update query that deletes the graph of a challenge.
|
private static String |
DELETE_EXPERIMENT_GRAPH_QUERY
An update query that deletes the graph of an experiment.
|
private static org.apache.jena.rdf.model.Model |
EMPTY_MODEL |
private static String |
EXPERIMENT_PLACEHOLDER |
private static String |
GET_CHALLENGE_GRAPH_QUERY
A construct query that retrieves the graph of a challenge.
|
private static String |
GET_CHALLENGE_PUBLISH_INFO_QUERY
A construct query that retrieves the graph of a challenge.
|
private static String |
GET_CHALLENGE_TASK_ORGANIZER
A construct query for getting the organizer of the challenge two which a
given challenge tasks belong to.
|
private static String |
GET_CHALLENGE_TASKS_QUERY
A construct query that retrieves the tasks of a challenge.
|
private static String |
GET_EXPERIMENT_OF_TASK_QUERY
A construct query that selects the graph of an experiment that is part of
a given challenge task.
|
private static String |
GET_EXPERIMENT_QUERY
A construct query that selects the graph of an experiment.
|
private static String |
GET_REPEATABLE_CHALLENGE_INFO_QUERY
A construct query that retrieves the graph of a repeatable challenge.
|
private static String |
GET_SHALLOW_CHALLENGE_GRAPH_QUERY
A construct query that retrieves a shallow of a challenge.
|
private static String |
GET_SHALLOW_EXPERIMENT_QUERY
A construct query that selects a shallow graph of an experiment.
|
private static String |
GRAPH_PLACEHOLDER |
private static org.slf4j.Logger |
LOGGER |
private static String |
MOVE_CHALLENGE_SYSTEM_QUERY
An update query that moves involvesSystem triples between graphs.
|
private static String |
NEW_GRAPH_PLACEHOLDER |
private static String |
SYSTEM_PLACEHOLDER |
private static String |
VALUE_PLACEHOLDER |
| Constructor and Description |
|---|
SparqlQueries() |
| Modifier and Type | Method and Description |
|---|---|
static String[] |
cleanUpChallengeGraphQueries(String graphUri)
Returns a SPARQL update query for cleaning up the graph of a challenge
configs.
|
static String |
cleanUpChallengeGraphQuery(String graphUri)
Deprecated.
A single large query does not seem to be supported by all
triple stores. Use
cleanUpChallengeGraphQueries(String) instead. |
static String[] |
cleanUpPrivateGraphQueries(String graphUri)
Returns a SPARQL update query for cleaning up the private result graph.
|
static String |
countExperimentsOfTaskQuery(String challengeTaskUri,
String graphUri)
Returns a SPARQL query for counting the number of experiments of a
challenge task.
|
static String |
deleteChallengeGraphQuery(String challengeUri,
String graphUri)
Returns a SPARQL update query for deleting the graph of a challenge.
|
static String |
deleteExperimentGraphQuery(String experimentUri,
String graphUri)
Returns a SPARQL update query for deleting the graph of an experiment.
|
static String |
getChallengeGraphQuery(String challengeUri,
String graphUri)
Returns a SPARQL query for retrieving the graph of a challenge.
|
static 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.
|
static 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.
|
static String |
getChallengeTasksQuery(String challengeUri,
String graphUri)
Returns a SPARQL query for retrieving the tasks of a challenge.
|
static String |
getCloseChallengeQuery(String challengeUri,
String graphUri)
Returns a SPARQL query for adding the closed triple to the challenge with
the given URI.
|
static 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.
|
static String |
getExperimentGraphOfSystemsQuery(List<String> systemUris,
String graphUri)
Returns a SPARQL query for retrieving the graphs of experiments that
involve one of the given systems.
|
static String |
getExperimentGraphQuery(String experimentUri,
String graphUri)
Returns a SPARQL query for retrieving the graph of an experiment.
|
static 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.
|
static String |
getMoveChallengeSystemQuery(String challengeUri,
String graphUri,
String newGraphUri)
Returns a SPARQL query for moving involvesSystem triples between graphs
for a challenge with given URI.
|
static String |
getRepeatableChallengeInfoQuery(String challengeUri,
String graphUri)
Returns a SPARQL query for retrieving a graph comprising
repeatable challenge properties if this challenge is closed.
|
static String |
getShallowChallengeGraphQuery(String challengeUri,
String graphUri)
Returns a SPARQL query for retrieving a shallow graph of a challenge.
|
static 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.
|
static 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.
|
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 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.
|
static 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.
|
private static String |
loadQuery(String resourceName)
Loads the given resource, e.g., a SPARQL query, as String.
|
private static String |
replacePlaceholders(String query,
String[] placeholders,
String[] replacements)
Replaces the given placeholders in the given query with the given
replacements.
|
private static final org.slf4j.Logger LOGGER
private static final String CHALLENGE_PLACEHOLDER
private static final String CHALLENGE_TASK_PLACEHOLDER
private static final String EXPERIMENT_PLACEHOLDER
private static final String GRAPH_PLACEHOLDER
private static final String NEW_GRAPH_PLACEHOLDER
private static final String SYSTEM_PLACEHOLDER
private static final String VALUE_PLACEHOLDER
private static final int DEFAULT_MAX_UPDATE_QUERY_TRIPLES
private static final org.apache.jena.rdf.model.Model EMPTY_MODEL
private static final String GET_CHALLENGE_GRAPH_QUERY
private static final String GET_SHALLOW_CHALLENGE_GRAPH_QUERY
private static final String GET_CHALLENGE_TASKS_QUERY
private static final String GET_CHALLENGE_PUBLISH_INFO_QUERY
private static final String GET_REPEATABLE_CHALLENGE_INFO_QUERY
private static final String CLOSE_CHALLENGE_UPDATE_QUERY
private static final String DATE_OF_NEXT_EXECUTION_UPDATE_QUERY
private static final String MOVE_CHALLENGE_SYSTEM_QUERY
private static final String GET_EXPERIMENT_QUERY
private static final String GET_SHALLOW_EXPERIMENT_QUERY
private static final String GET_EXPERIMENT_OF_TASK_QUERY
private static final String CREATE_EXPERIMENT_FROM_CHALLENGE_TASK
private static final String DELETE_EXPERIMENT_GRAPH_QUERY
private static final String DELETE_CHALLENGE_GRAPH_QUERY
@Deprecated private static final String CLEAN_UP_CHALLENGE_GRAPH_QUERY
private static final String[] CLEAN_UP_CHALLENGE_GRAPH_QUERIES
private static final String[] CLEAN_UP_PRIVATE_GRAPH_QUERIES
private static final String COUNT_EXP_OF_TASK_QUERY
private static final String GET_CHALLENGE_TASK_ORGANIZER
private static final String loadQuery(String resourceName)
resourceName - name of the resource that should be loadednull if an error occurspublic static final String getChallengeGraphQuery(String challengeUri, String graphUri)
challengeUri - URI of the challenge that should be retrieved.
null works like a wildcard.graphUri - URI of the graph the challenge is stored. null
works like a wildcard.null if the query hasn't been loaded correctlypublic static final String getShallowChallengeGraphQuery(String challengeUri, String graphUri)
challengeUri - URI of the challenge that should be retrieved.
null works like a wildcard.graphUri - URI of the graph the challenge is stored. null
works like a wildcard.null if the query hasn't been loaded correctlypublic static final String getChallengeTasksQuery(String challengeUri, String graphUri)
challengeUri - URI of the challenge that should be retrieved.
null works like a wildcard.graphUri - URI of the graph the challenge is stored. null
works like a wildcard.null if the query hasn't been loaded correctlypublic static final String getChallengePublishInfoQuery(String challengeUri, String graphUri)
challengeUri - URI of the challenge that should be retrieved.
null works like a wildcard.graphUri - URI of the graph the challenge is stored. null
works like a wildcard.null if the query hasn't been loaded correctlypublic static final String getRepeatableChallengeInfoQuery(String challengeUri, String graphUri)
challengeUri - URI of the challenge that should be retrieved.
null works like a wildcard.graphUri - URI of the graph the challenge is stored. null
works like a wildcard.null if the query hasn't been loaded correctlypublic static final String getCloseChallengeQuery(String challengeUri, String graphUri)
challengeUri - URI of the challenge that should be closed. null
works like a wildcard.graphUri - URI of the graph the challenge is stored. null
works like a wildcard.null if the query hasn't been loaded correctlypublic static final String getUpdateDateOfNextExecutionQuery(String challengeUri, Calendar newValue, String graphUri)
challengeUri - URI of the challenge that should be updated. null
works like a wildcard.newValue - New value for date of next execution. null
to remove the value.graphUri - URI of the graph the challenge is stored. null
works like a wildcard.null if the query hasn't been loaded correctlypublic static final String getMoveChallengeSystemQuery(String challengeUri, String graphUri, String newGraphUri)
challengeUri - URI of the challenge that should be updated. null
works like a wildcard.graphUri - URI of the challenge definition graph.newGraphUri - URI of the public data graph.null if the query hasn't been loaded correctlypublic static final String getExperimentGraphQuery(String experimentUri, String graphUri)
experimentUri - URI of the experiment that should be retrieved.
null works like a wildcard.graphUri - URI of the graph the experiment is stored. null
works like a wildcard.null if the query hasn't been loaded correctlypublic static final String getShallowExperimentGraphQuery(String experimentUri, String graphUri)
experimentUri - URI of the experiment that should be retrieved.
null works like a wildcard.graphUri - URI of the graph the experiment is stored. null
works like a wildcard.null if the query hasn't been loaded correctlypublic static final String getExperimentGraphOfSystemsQuery(List<String> systemUris, String graphUri)
systemUris - URIs of the systems that might be involved in the experiment.graphUri - URI of the graph the experiment is stored. null
works like a wildcard.null if the query hasn't been loaded correctlypublic static final String getExperimentOfTaskQuery(String experimentUri, String challengeTaskUri, String graphUri)
experimentUri - URI of the experiment that should be retrieved.
null works like a wildcard.challengeTaskUri - URI of the challenge task from which the experiment should be
created. null works like a wildcard.graphUri - URI of the graph the experiment is stored. null
works like a wildcard.null if the query hasn't been loaded correctlypublic static final String getCreateExperimentFromTaskQuery(String experimentUri, String challengeTaskUri, String systemUri, String graphUri)
experimentUri - URI of the newly created experiment.challengeTaskUri - URI of the challenge task from which the experiment should be
created. null works like a wildcard.systemUri - URI of the system of the experiment. null works
like a wildcard.graphUri - URI of the graph the experiment is stored. null
works like a wildcard.null if the query hasn't been loaded correctlyIllegalArgumentException - if the given experimentUri is nullpublic static final String deleteExperimentGraphQuery(String experimentUri, String graphUri)
experimentUri - URI of the experiment that should be retrieved.
null works like a wildcard.graphUri - URI of the graph the challenge is stored.null if the query hasn't been loaded correctlypublic static final String deleteChallengeGraphQuery(String challengeUri, String graphUri)
challengeUri - URI of the challenge that should be retrieved.
null works like a wildcard.graphUri - URI of the graph the challenge is stored.null if the query hasn't been loaded correctly@Deprecated public static final String cleanUpChallengeGraphQuery(String graphUri)
cleanUpChallengeGraphQueries(String) instead.graphUri - URI of the graph the challenge is stored. null
works like a wildcard.null if the query hasn't been loaded correctlypublic static final String[] cleanUpChallengeGraphQueries(String graphUri)
graphUri - URI of the challenge configuration graph.null if the query hasn't been loaded correctlypublic static final String[] cleanUpPrivateGraphQueries(String graphUri)
graphUri - URI of the private result graph.null if the query hasn't been loaded correctlypublic static final String countExperimentsOfTaskQuery(String challengeTaskUri, String graphUri)
challengeTaskUri - URI of the challenge taskgraphUri - URI of the graph the experiment is stored. null
works like a wildcard.null if the query hasn't been loaded correctlypublic static final String getChallengeTaskOrganizer(String challengeTaskUri, String graphUri)
challengeTaskUri - URI of the challenge taskgraphUri - URI of the graph the experiment is stored. null
works like a wildcard.null if the query hasn't been loaded correctlyprivate static final String replacePlaceholders(String query, String[] placeholders, String[] replacements)
null, it is replaced by a
variable.query - the query containing placeholdersplaceholders - the placeholders that should be replacedreplacements - the replacements that should be used to replace the
placeholders.null if the given query
was null.public static final String getUpdateQueryFromDiff(org.apache.jena.rdf.model.Model original, org.apache.jena.rdf.model.Model updated, String graphUri)
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.
original - the original RDF modelupdated - the updated RDF modelgraphUri - the URI of the graph to which the UPDATE query should be
applied or nullpublic 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)
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 querypublic static final String[] getUpdateQueriesFromDiff(org.apache.jena.rdf.model.Model original, org.apache.jena.rdf.model.Model updated, String graphUri)
original - the original RDF model (null is interpreted as an
empty model)updated - the updated RDF model (null is interpreted as an empty
model)graphUri - the URI of the graph to which the UPDATE query should be
applied or nullpublic static final String[] getUpdateQueriesFromDiff(org.apache.jena.rdf.model.Model original, org.apache.jena.rdf.model.Model updated, String graphUri, int maxTriplesPerQuery)
original - the original RDF model (null is interpreted as an
empty model)updated - the updated RDF model (null is interpreted as an empty
model)graphUri - the URI of the graph to which the UPDATE query should be
applied or nullmaxTriplesPerQuery - the maximum number of triples a single query should containCopyright © 2017–2018. All rights reserved.