-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3466193
commit fbf85b2
Showing
5 changed files
with
129 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/test/java/org/dice_research/enexa/transform/QueryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.dice_research.enexa.transform; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
import org.apache.jena.query.ParameterizedSparqlString; | ||
import org.apache.jena.riot.Lang; | ||
import org.dice_research.sparql.SparqlQueryUtils; | ||
import org.dice_research.sparql.test.ConstructQueryTest; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
import org.junit.runners.Parameterized.Parameters; | ||
|
||
@RunWith(Parameterized.class) | ||
public class QueryTest extends ConstructQueryTest { | ||
|
||
public static final String META_DATA_GRAPH_IRI = "http://example.org/meta-graph"; | ||
public static final String SECOND_GRAPH_IRI = "http://example.org/other-graph"; | ||
|
||
public QueryTest(String storeContentResource, Lang storeContentLang, String expectedResultResource, | ||
Lang expectedResultLang, String query) { | ||
super(META_DATA_GRAPH_IRI, SECOND_GRAPH_IRI, storeContentResource, storeContentLang, expectedResultResource, expectedResultLang, query); | ||
} | ||
|
||
@Parameters | ||
public static Collection<Object[]> data() { | ||
final String MODULE_INSTANCE_VARIABLE = "?moduleInstance"; | ||
final String MODULE_INSTANCE_IRI = "http://example.org/module/123"; | ||
|
||
ParameterizedSparqlString query = SparqlQueryUtils.loadParameterizedQuery(QueryTest.class.getClassLoader(), | ||
"org/dice_research/enexa/transform/getParameters.query", StandardCharsets.UTF_8); | ||
query.setIri(MODULE_INSTANCE_VARIABLE, MODULE_INSTANCE_IRI); | ||
query.setIri("?graph", META_DATA_GRAPH_IRI); | ||
|
||
List<Object[]> testConfigs = new ArrayList<Object[]>(); | ||
testConfigs.add(new Object[] { "org/dice_research/enexa/transform/testDataset.ttl", Lang.TURTLE, | ||
"org/dice_research/enexa/transform/expectedParameters.ttl", Lang.TURTLE, query.toString() }); | ||
return testConfigs; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/test/resources/org/dice_research/enexa/transform/expectedParameters.ttl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@prefix dcat: <http://www.w3.org/ns/dcat#> . | ||
@prefix enexa: <http://w3id.org/dice-research/enexa/ontology#> . | ||
@prefix hobbit: <http://w3id.org/hobbit/vocab#> . | ||
@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
@prefix prov: <http://www.w3.org/ns/prov#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix sd: <http://www.w3.org/ns/sparql-service-description#> . | ||
@prefix xsd: <http://www.w3.org/2000/10/XMLSchema#> . | ||
|
||
<http://example.org/module/123> <http://w3id.org/dice-research/enexa/module/transform/parameter/input> <http://example.org/experiment1/data/kg/dump.ttl> ; | ||
<http://w3id.org/dice-research/enexa/module/transform/parameter/input> <http://example.org/experiment1/data/kg/dump2.json> ; | ||
<http://w3id.org/dice-research/enexa/module/transform/parameter/outputMediaType> <https://www.iana.org/assignments/media-types/application/n-triples> . | ||
|
||
<http://example.org/experiment1/data/kg/dump.ttl> enexa:location "enexa-dir://application1/experiment1/kg/dump.ttl" . | ||
|
||
<http://example.org/experiment1/data/kg/dump2.json> enexa:location "enexa-dir://application1/experiment1/kg/dump2.json" . | ||
|
53 changes: 53 additions & 0 deletions
53
src/test/resources/org/dice_research/enexa/transform/testDataset.ttl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
@prefix dcat: <http://www.w3.org/ns/dcat#> . | ||
@prefix enexa: <http://w3id.org/dice-research/enexa/ontology#> . | ||
@prefix hobbit: <http://w3id.org/hobbit/vocab#> . | ||
@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
@prefix prov: <http://www.w3.org/ns/prov#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix sd: <http://www.w3.org/ns/sparql-service-description#> . | ||
@prefix xsd: <http://www.w3.org/2000/10/XMLSchema#> . | ||
|
||
<http://example.org/module/123> a enexa:ModuleInstance, prov:Activity ; | ||
enexa:experiment <http://example.org/experiment1> ; | ||
enexa:instanceOf <http://w3id.org/dice-research/enexa/module/transform/0.0.1> ; | ||
enexa:dnsName "diceTransformer1" ; | ||
enexa:containerId "the ID of the container" ; | ||
prov:startedAtTime "2023-04-01T12:35:58Z"^^xsd:dateTime ; | ||
<http://w3id.org/dice-research/enexa/module/transform/parameter/input> <http://example.org/experiment1/data/kg/dump.ttl> ; | ||
<http://w3id.org/dice-research/enexa/module/transform/parameter/input> <http://example.org/experiment1/data/kg/dump2.json> ; | ||
<http://w3id.org/dice-research/enexa/module/transform/parameter/outputMediaType> <https://www.iana.org/assignments/media-types/application/n-triples> . | ||
|
||
<http://example.org/experiment1> a enexa:Experiment ; | ||
enexa:sharedDirectory "enexa-dir://application1/experiment1" ; | ||
enexa:metaDataEndpoint <http://enexa-endpoint/sparql> ; | ||
enexa:metaDataGraph <http://example.org/experiment1/graph> . | ||
|
||
<http://example.org/experiment1/modules/fileDownload_1> a prov:Activity ; | ||
enexa:experiment <http://example.org/experiment1> ; | ||
prov:startedAtTime "2023-04-01T12:05:21Z"^^xsd:dateTime ; | ||
prov:endedAtTime "2023-04-01T12:31:29Z"^^xsd:dateTime ; | ||
prov:used <http://some-server.com/data-directory/dump.ttl> . | ||
|
||
<http://example.org/experiment1/data/kg/dump.ttl> a prov:Entity ; | ||
enexa:experiment <http://example.org/experiment1> ; | ||
enexa:location "enexa-dir://application1/experiment1/kg/dump.ttl" ; | ||
prov:wasGeneratedBy <http://example.org/experiment1/modules/fileDownload_1> ; | ||
dcat:mediaType <https://www.iana.org/assignments/media-types/text/turtle> ; | ||
dcat:byteSize "5120"^^xsd:nonNegativeInteger . | ||
|
||
<http://example.org/experiment1/data/kg/dump2.json> a prov:Entity ; | ||
enexa:experiment <http://example.org/experiment1> ; | ||
enexa:location "enexa-dir://application1/experiment1/kg/dump2.json" ; | ||
dcat:mediaType <https://www.iana.org/assignments/media-types/application/ld+json> . | ||
|
||
<http://example.org/module/456> a enexa:ModuleInstance, prov:Activity ; | ||
enexa:experiment <http://example.org/experiment1> ; | ||
enexa:instanceOf <http://w3id.org/dice-research/enexa/module/transform/0.0.1> ; | ||
enexa:dnsName "diceTransformer2" ; | ||
enexa:containerId "the ID of the container" ; | ||
prov:startedAtTime "2023-04-01T12:35:58Z"^^xsd:dateTime ; | ||
<http://w3id.org/dice-research/enexa/module/transform/parameter/input> <http://example.org/experiment1/data/kg/dump3.ttl> ; | ||
<http://w3id.org/dice-research/enexa/module/transform/parameter/input> <http://example.org/experiment1/data/kg/dump4.json> ; | ||
<http://w3id.org/dice-research/enexa/module/transform/parameter/outputMediaType> <https://www.iana.org/assignments/media-types/application/n-triples> . | ||
|