Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
luigi-asprino committed Jun 7, 2023
1 parent 73f939f commit b61066d
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public class AbstractTriplifierTester {
protected boolean useDatasetGraph = false;
protected boolean throwsException = false;
protected String expectedExtension;
private boolean printWholeGraph = false;
protected boolean loadExpectedResult = true;
protected boolean printWholeGraph = false;

public AbstractTriplifierTester(Triplifier t, Properties p, String extension) {
this(t, p, extension, "ttl");
Expand Down Expand Up @@ -93,7 +94,7 @@ protected void prepare() throws URISyntaxException {
url = getClass().getClassLoader().getResource(fileName);
properties.setProperty("location", url.toURI().toString());
properties.setProperty("blank-nodes", "false");
logger.debug("Input location: {}", url.toURI().toString());
logger.debug("Input location: {}", url.toURI());
properties.setProperty("root", "http://www.example.org/document");
//
// RDF file name
Expand All @@ -105,12 +106,13 @@ protected void prepare() throws URISyntaxException {
} else {
rdfFileName = name.getMethodName().substring(4) + "." + expectedExtension;
}
if (!useDatasetGraph) {
expected = RDFDataMgr.loadModel(getClass().getClassLoader().getResource(rdfFileName).toURI().toString())
.getGraph();
} else {
expectedDatasetGraph = replaceLocation(RDFDataMgr
.loadDatasetGraph(getClass().getClassLoader().getResource(rdfFileName).toURI().toString()));

if (loadExpectedResult) {
if (!useDatasetGraph) {
expected = RDFDataMgr.loadModel(getClass().getClassLoader().getResource(rdfFileName).toURI().toString()).getGraph();
} else {
expectedDatasetGraph = replaceLocation(RDFDataMgr.loadDatasetGraph(getClass().getClassLoader().getResource(rdfFileName).toURI().toString()));
}
}

}
Expand Down Expand Up @@ -203,8 +205,7 @@ protected void assertNotBlankNode() {
protected DatasetGraph replaceLocation(DatasetGraph g) {
DatasetGraph dg = DatasetGraphFactory.create();
g.find().forEachRemaining(q -> {
dg.add(new Quad(resolveNode(q.getGraph()), new Triple(resolveNode(q.getSubject()),
resolveNode(q.getPredicate()), resolveNode(q.getObject()))));
dg.add(new Quad(resolveNode(q.getGraph()), new Triple(resolveNode(q.getSubject()), resolveNode(q.getPredicate()), resolveNode(q.getObject()))));
});
return dg;
}
Expand Down

0 comments on commit b61066d

Please sign in to comment.