A project to execute SPARQL queries from string, URL or multiple files using RDF4J.
-sp param-f param.rq files to execute in -f param.rq text files and executed in the alphabetical order of their filename.BETA: available on DockerHub the latest image is automatically built from latest branch master commit on GitHub.
docker pull vemonet/data2services-sparql-operations
You can also clone the GitHub repository and build the docker image locally (unecessary if you do docker pull)
git clone https://github.com/MaastrichtU-IDS/data2services-sparql-operations
docker build -t vemonet/data2services-sparql-operations .
N.B.: you will need to remove the \ and make the docker run commands one-line for Windows PowerShell.
docker run -it --rm vemonet/data2services-sparql-operations -h
On DBpedia using a SPARQL query string as argument.
docker run -it --rm vemonet/data2services-sparql-operations -op select \
-sp "select distinct ?Concept where {[] a ?Concept} LIMIT 10" \
-ep "http://dbpedia.org/sparql"
Multiple INSERT on graphdb.dumontierlab.com, using files in a repository from the local file system.
docker run -it --rm vemonet/data2services-sparql-operations \
-ep "http://graphdb.dumontierlab.com" -rep "test" \
#-ep "http://graphdb.dumontierlab.com/repositories/test/statements" \
-op update -un $USERNAME -pw $PASSWORD \
-f "https://raw.githubusercontent.com/MaastrichtU-IDS/data2services-sparql-operations/master/src/main/resources/example-insert.rq"
/statements at the end of the endpoint URL when doing an update.On graphdb.dumontierlab.com using GitHub URL to get the SPARQL query from a file.
docker run -it --rm vemonet/data2services-sparql-operations -op construct \
-ep "http://graphdb.dumontierlab.com/repositories/ncats-red-kg" \
-f "https://raw.githubusercontent.com/MaastrichtU-IDS/data2services-sparql-operations/master/src/main/resources/example-construct-pathways.rq"
We crawl the example GitHub repository and execute each .rq file.
docker run -it --rm vemonet/data2services-sparql-operations \
-op select -ep "http://dbpedia.org/sparql" \
-f "https://github.com/MaastrichtU-IDS/data2services-sparql-operations/tree/master/src/main/resources/select-examples"
A YAML file can be used to provide multiple ordered queries. See example from GitHub.
docker run -it --rm vemonet/data2services-sparql-operations \
-op select -ep "http://dbpedia.org/sparql" \
-f "https://raw.githubusercontent.com/MaastrichtU-IDS/data2services-sparql-operations/master/src/main/resources/example-queries.yaml"
Beta To split an object into multiple statements using a delimiter, and insert the statements generated by the split in the same graph.
E.g.: a statement with value "1234,345,768" would be splitted in 3 statements "1234", "345" and "768".
docker run -it \
vemonet/data2services-sparql-operations -op split \
--split-property "http://w3id.org/biolink/vocab/has_participant" \
--split-class "http://w3id.org/biolink/vocab/GeneGrouping" \
--split-delimiter "," \
--split-delete \ # Delete the splitted statement
--uri-expansion "https://w3id.org/data2services/" \ # Use 'infer' to do it automatically using prefixcommons
#--trim-delimiter '"' \
-ep "http://graphdb.dumontierlab.com" \ # RDF4J server URL
-rep "test" \ # RDF4J server repository ID
-un USERNAME -pw PASSWORD
# For SPARQLRepository
# -ep "http://graphdb.dumontierlab.com/repositories/test" \
# -uep "http://graphdb.dumontierlab.com/repositories/test/statements" \
3 variables can be set in the SPARQL queries using a ?_: ?_inputGraph, ?_outputGraph and ?_serviceUrl. See example:
INSERT {
GRAPH <?_outputGraph> {
?Concept a <https://w3id.org/data2services/Concept> .
}
} WHERE {
SERVICE <?_serviceUrl> {
GRAPH <?_inputGraph> {
SELECT * {
[] a ?Concept .
} LIMIT 10
} } }
Execute:
docker run -it --rm vemonet/data2services-sparql-operations \
-op update -ep "http://graphdb.dumontierlab.com/repositories/test/statements" \
-un $USERNAME -pw $PASSWORD \
-f "https://raw.githubusercontent.com/MaastrichtU-IDS/data2services-sparql-operations/master/src/main/resources/example-insert-variables.rq" \
--var-inputGraph http://www.ontotext.com/explicit \
--var-outputGraph https://w3id.org/data2services/output \
--var-serviceUrl http://localhost:7200/repositories/test
From data2services-transform-repository, use a federated query to transform generic RDF generated by AutoR2RML and xml2rdf to the BioLink model, and load it to a different repository.
# DrugBank
docker run -it --rm -v "$PWD/sparql/insert-biolink/drugbank":/data \
vemonet/data2services-sparql-operations \
-f "/data" -un USERNAME -pw PASSWORD \
-ep "http://graphdb.dumontierlab.com/repositories/ncats-test/statements" \
-varServiceUrl http://localhost:7200/repositories/test \
-varInputGraph http://data2services/graph/xml2rdf \
-varOutputGraph https://w3id.org/data2services/graph/biolink/drugbank
# HGNC
docker run -it --rm -v "$PWD/sparql/insert-biolink/hgnc":/data \
vemonet/data2services-sparql-operations \
-f "/data" -un USERNAME -pw PASSWORD \
-ep "http://graphdb.dumontierlab.com/repositories/ncats-test/statements" \
--var-serviceUrl http://localhost:7200/repositories/test \
--var-inputGraph http://data2services/graph/autor2rml \
--var-outputGraph https://w3id.org/data2services/graph/biolink/hgnc
Content type
Image
Digest
Size
83.7 MB
Last updated
almost 7 years ago
docker pull aammar/data2services-sparql-operations