Skip to content

Commit 2a76e2e

Browse files
committed
Merge branch 'staging' into develop
2 parents 2145996 + 79f9bcb commit 2a76e2e

File tree

12 files changed

+589
-258
lines changed

12 files changed

+589
-258
lines changed

.github/workflows/pages.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
JEKYLL_ENV: production
5454
- name: Upload artifact
5555
# Automatically uploads an artifact from the './_site' directory by default
56-
uses: actions/upload-pages-artifact@v1
56+
uses: actions/upload-pages-artifact@v3
5757
with:
5858
path: "docs/_site/"
5959

@@ -67,5 +67,5 @@ jobs:
6767
steps:
6868
- name: Deploy to GitHub Pages
6969
id: deployment
70-
uses: actions/deploy-pages@v2
70+
uses: actions/deploy-pages@v4
7171

docs/integrate/engines.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: Embedded SPARQL Engines
3+
has_children: true
4+
nav_order: 35
5+
layout: default
6+
---
7+
8+
# Embedded SPARQL Engines
9+
10+
The following engines can be used using `rpt integrate -e engine [--loc engine-specific-location]`.
11+
12+
Embedded SPARQL engines are built into RPT and thus readily available. The following engines are currently available:
13+
14+
<table>
15+
<tr><th>Engine</th><th>Description</th></tr>
16+
<tr><td><b>mem</b></td><td>The default in-memory engine based on Apache Jena. Data is discarded once the RPT process terminates.</td></tr>
17+
<tr><td><b>tdb2</b></td><td>Apache Jena's TDB2 persisent engine. Use <i>--loc</i> to specfify the database folder.</td></tr>
18+
<tr><td><b>binsearch</b></td><td>Binary search engine that operates directly on sorted N-Triples files. Use <i>--loc</i> to specify the file path or HTTP(s) URL to the N-Triples file. For URLs, HTTP range requests must be supported!</td></tr>
19+
<tr><td><b>remote</b></td><td>A pseudo engine that forwards all processing to the SPARQL endpoint whole URL is specified in <i>--loc</i>.</td></tr>
20+
</table>
21+
22+
### (ARQ) Engine Configuration
23+
24+
The engines `mem`, `tdb2` and `binsearch` build an Jena's query engine `ARQ` and thus respect its configuration.
25+
26+
`rpt integrate --set 'arq:queryTimeout=60000' --set 'arq:updateTimeout=1800000' data.ttl myUpdate.ru myQuery.rq`
27+
28+
29+
30+

docs/integrate/index.md

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -92,28 +92,3 @@ Statements that intrinsically do not rely on the spatial index, namely `LOAD`, `
9292

9393
`rpt integrate --server --geoindex spatial-data.ttl`
9494

95-
96-
## Embedded SPARQL Engines
97-
98-
Embedded SPARQL engines are built into RPT and thus readily available. The following engines are currently available:
99-
100-
<table>
101-
<tr><th>Engine</th><th>Description</th></tr>
102-
<tr><td><b>mem</b></td><td>The default in-memory engine based on Apache Jena. Data is discarded once the RPT process terminates.</td></tr>
103-
<tr><td><b>tdb2</b></td><td>Apache Jena's TDB2 persisent engine. Use <i>--loc</i> to specfify the database folder.</td></tr>
104-
<tr><td><b>binsearch</b></td><td>Binary search engine that operates directly on sorted N-Triples files. Use <i>--loc</i> to specify the file path or HTTP(s) URL to the N-Triples file. For URLs, HTTP range requests must be supported!</td></tr>
105-
<tr><td><b>remote</b></td><td>A pseudo engine that forwards all processing to the SPARQL endpoint whole URL is specified in <i>--loc</i>.</td></tr>
106-
<tr><td><b>qlever</b></td><td>The blazing fast <a href="https://github.com/ad-freiburg/qlever">qlever</a> triple store launched from its docker image via Java's TestContainers framework. Use <code>qlever:imageName:tag</code> to use a specific image - this image's command line interfaces for starting the server and creating the indexes must be compatible with the default image registered with RPT.</td></tr>
107-
</table>
108-
109-
110-
111-
### (ARQ) Engine Configuration
112-
113-
The engines `mem`, `tdb2` and `binsearch` build an Jena's query engine `ARQ` and thus respect its configuration.
114-
115-
`rpt integrate --set 'arq:queryTimeout=60000' myQuery.rq`
116-
117-
118-
119-

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@
5757

5858
<spring-boot.version>2.3.3.RELEASE</spring-boot.version>
5959

60-
<jena.version>5.3.0-SNAPSHOT</jena.version>
61-
<jenax.version>5.3.0-1-SNAPSHOT</jenax.version>
60+
<jena.version>5.4.0-SNAPSHOT</jena.version>
61+
<jenax.version>5.4.0-1-SNAPSHOT</jenax.version>
6262
<rmltk.version>5.2.0-1-SNAPSHOT</rmltk.version>
63-
<conjure.version>5.2.0-1-SNAPSHOT</conjure.version>
63+
<conjure.version>5.4.0-1-SNAPSHOT</conjure.version>
6464
<sansa.version>0.9.6-SNAPSHOT</sansa.version>
6565
<!-- <jenax.version>3.14.0-2-SNAPSHOT</jenax.version> -->
6666
<!-- <slf4j.version>1.8.0-beta4</slf4j.version> -->

rdf-processing-toolkit-cli/pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@
6161
<groupId>org.aksw.jenax</groupId>
6262
<artifactId>jenax-rx-dataaccess</artifactId>
6363
</dependency>
64+
<dependency>
65+
<groupId>org.aksw.jenax</groupId>
66+
<artifactId>jenax-arq-connection-qlever</artifactId>
67+
<version>5.4.0-1-SNAPSHOT</version>
68+
</dependency>
69+
6470
<dependency>
6571
<groupId>org.aksw.jenax</groupId>
6672
<artifactId>jenax-io-core</artifactId>
@@ -202,7 +208,7 @@
202208
<dependency>
203209
<groupId>junit</groupId>
204210
<artifactId>junit</artifactId>
205-
<scope>test</scope>
211+
<scope>compile</scope> <!-- test containers requires junit -->
206212
</dependency>
207213
<!--
208214
<dependency>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package org.aksw.rdf_processing_toolkit.cli.cmd;
2+
3+
import java.io.Serializable;
4+
import java.util.ArrayList;
5+
import java.util.List;
6+
7+
import org.apache.jena.sparql.core.DatasetDescription;
8+
9+
import picocli.CommandLine.Option;
10+
11+
public class CmdMixinSparqlDataset
12+
implements Serializable
13+
{
14+
private static final long serialVersionUID = 1L;
15+
16+
@Option(names = { "--dg", "--default-graph" }, description="Default graph")
17+
public List<String> defaultGraphs = new ArrayList<>();
18+
19+
@Option(names = { "--ng", "--named-graph" }, description="Named graph")
20+
public List<String> namedGraphs = new ArrayList<>();
21+
22+
@Option(names = { "--service" }, description = "SPARQL endpoint URL")
23+
public boolean serviceUrl;
24+
25+
public static DatasetDescription toDatasetDescription(CmdMixinSparqlDataset cmd) {
26+
return new DatasetDescription(cmd.defaultGraphs, cmd.namedGraphs);
27+
}
28+
}

rdf-processing-toolkit-cli/src/main/java/org/aksw/rdf_processing_toolkit/cli/cmd/CmdRptMain.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import org.aksw.commons.picocli.CmdCatClasspathResource;
44
import org.aksw.named_graph_stream.cli.cmd.CmdNgsMain;
5+
import org.aksw.rdf_processing_toolkit.cli.cmd.graphql.CmdGraphQlTkParent;
56
import org.aksw.rml.cli.cmd.CmdRmlTkParent;
67
import org.aksw.sparql_binding_stream.cli.cmd.CmdSbsMain;
78
import org.aksw.sparql_integrate.cli.cmd.CmdSparqlIntegrateMain;
@@ -14,7 +15,8 @@
1415
CmdSbsMain.class,
1516
CmdRmlTkParent.class,
1617
// CmdBenchParent.class, Hard-coding benchmarking modules does not really fit RPT - maybe in the future as plugins?
17-
CmdCatClasspathResource.class
18+
CmdCatClasspathResource.class,
19+
CmdGraphQlTkParent.class
1820
// CmdRml2Exec.class
1921
})
2022
public class CmdRptMain
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package org.aksw.rdf_processing_toolkit.cli.cmd.graphql;
2+
3+
import java.io.OutputStreamWriter;
4+
import java.io.Writer;
5+
import java.util.ArrayList;
6+
import java.util.List;
7+
import java.util.concurrent.Callable;
8+
9+
import org.aksw.commons.io.util.StdIo;
10+
import org.aksw.jena_sparql_api.rx.script.SparqlScriptProcessor;
11+
import org.aksw.jenax.dataaccess.sparql.datasource.RdfDataSource;
12+
import org.aksw.jenax.dataaccess.sparql.factory.datasource.RdfDataSources;
13+
import org.aksw.jenax.graphql.schema.generator.GraphQlSchemaGenerator;
14+
import org.aksw.jenax.graphql.schema.generator.GraphQlSchemaGenerator.TypeInfo;
15+
import org.aksw.jenax.stmt.core.SparqlStmt;
16+
import org.aksw.jenax.stmt.util.SparqlStmtUtils;
17+
import org.aksw.rdf_processing_toolkit.cli.cmd.CmdMixinSparqlDataset;
18+
import org.apache.jena.query.Dataset;
19+
import org.apache.jena.query.DatasetFactory;
20+
import org.apache.jena.rdfconnection.RDFConnection;
21+
22+
import graphql.language.AstPrinter;
23+
import graphql.language.Document;
24+
import graphql.parser.Parser;
25+
import picocli.CommandLine.Command;
26+
import picocli.CommandLine.Mixin;
27+
import picocli.CommandLine.Option;
28+
import picocli.CommandLine.Parameters;
29+
30+
@Command(name = "schemagen", description = "Generate a schema GraphQL Schema over RDF data in files or in a SPARQL endpoinst.")
31+
public class CmdGraphQlSchemaGen
32+
implements Callable<Integer> {
33+
34+
@Option(names = { "-h", "--help" }, usageHelp = true)
35+
public boolean help = false;
36+
37+
@Mixin
38+
public CmdMixinSparqlDataset sparqlDataset = new CmdMixinSparqlDataset();
39+
40+
@Parameters(arity = "0..*", description = "Input files")
41+
public List<String> nonOptionArgs = new ArrayList<>();
42+
43+
@Override
44+
public Integer call() throws Exception {
45+
SparqlScriptProcessor processor = SparqlScriptProcessor.createWithEnvSubstitution(null);
46+
processor.process(nonOptionArgs);
47+
48+
Dataset dataset = DatasetFactory.create();
49+
try (RDFConnection conn = RDFConnection.connect(dataset)) {
50+
for (SparqlStmt stmt : processor.getPlainSparqlStmts()) {
51+
SparqlStmtUtils.execAny(conn, stmt, null);
52+
}
53+
}
54+
55+
RdfDataSource dataSource = RdfDataSources.of(dataset);
56+
List<TypeInfo> types = GraphQlSchemaGenerator.summarize(dataSource);
57+
58+
GraphQlSchemaGenerator generator = new GraphQlSchemaGenerator();
59+
Document doc = generator.process(types);
60+
String str = AstPrinter.printAst(doc);
61+
62+
try (Writer writer = new OutputStreamWriter(StdIo.openStdOutWithCloseShield())) {
63+
writer.write(str);
64+
}
65+
66+
boolean validateOutput = true;
67+
if (validateOutput) {
68+
Parser parser = new Parser();
69+
parser.parse(str);
70+
}
71+
72+
return 0;
73+
}
74+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package org.aksw.rdf_processing_toolkit.cli.cmd.graphql;
2+
3+
import org.aksw.rml.cli.cmd.VersionProviderRmlTk;
4+
5+
import picocli.CommandLine.Command;
6+
7+
@Command(name="graphqltk", versionProvider = VersionProviderRmlTk.class, description = "GraphQl Toolkit", subcommands = {
8+
CmdGraphQlSchemaGen.class
9+
})
10+
public class CmdGraphQlTkParent {
11+
}

rdf-processing-toolkit-cli/src/main/java/org/aksw/sparql_integrate/cli/cmd/CmdSparqlIntegrateMain.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ public static class OutputSpec {
203203
@Option(names= {"--macro-profile"}, description="Macro profile. 'auto' to auto-detect.") //, defaults to: '${DEFAULT-VALUE}'", defaultValue = "")
204204
public Set<String> macroProfiles = new LinkedHashSet<>();
205205

206+
// GraphQl
207+
208+
@Option(names= {"--graphql-schema"}, description="Annotated GraphQL schema file.") //, defaults to: '${DEFAULT-VALUE}'", defaultValue = "")
209+
public String graphQlSchema = null;
206210

207211
@Option(names = { "--graphql-autoconf" }, description = "Query SPARQL endpoint for VoID and SHACL metadata on first request to map an unqualified field",
208212
negatable = true, defaultValue = "true", fallbackValue = "true")

0 commit comments

Comments
 (0)