use of org.apache.jena.shacl.ValidationReport in project jena by apache.
the class Shacl03_FusekiValidationService method main.
public static void main(String... a) throws IOException {
FusekiLogging.setLogging();
// If not standard registration...
Operation op = Operation.alloc(FusekiVocab.NS + "shacl", "shacl", "SHACL valdiation");
// FusekiExt.registerOperation(op, new SHACL_Validation());
// FusekiExt.addDefaultEndpoint(op, "shacl");
// Operation op = Operation.Shacl;
FusekiServer server = FusekiServer.create().port(3030).add("/ds", DatasetGraphFactory.createTxnMem(), true).addEndpoint("/ds", "shacl", op).build();
try {
server.start();
try (RDFConnection conn = RDFConnection.connect("http://localhost:3030/ds")) {
conn.put("fu-data.ttl");
}
ValidationReport report = validateReport("http://localhost:3030/ds/shacl?graph=default", "fu-shapes.ttl");
System.out.println();
ShLib.printReport(report);
System.out.println();
System.out.println("- - - - - - - - - - - - - - - - - -");
System.out.println();
RDFDataMgr.write(System.out, report.getGraph(), Lang.TTL);
System.out.println();
} finally {
server.stop();
}
}
use of org.apache.jena.shacl.ValidationReport in project jena by apache.
the class TestFusekiShaclValidation method shacl_empty_shapes.
@Test
public void shacl_empty_shapes() {
try (RDFConnection conn = RDFConnection.connect(serverURL + "/ds")) {
conn.put(DIR + "data1.ttl");
ValidationReport report = validateReport(serverURL + "/ds/shacl?graph=default", DIR + "shapes-empty.ttl");
assertNotNull(report);
assertEquals(0, report.getEntries().size());
conn.update("CLEAR ALL");
}
}
use of org.apache.jena.shacl.ValidationReport in project jena by apache.
the class TestFusekiShaclValidation method shacl_named_graph.
@Test
public void shacl_named_graph() {
try (RDFConnection conn = RDFConnection.connect(serverURL + "/ds")) {
conn.put("urn:abc:graph", DIR + "data1.ttl");
ValidationReport report = validateReport(serverURL + "/ds/shacl?graph=urn:abc:graph", DIR + "shapes1.ttl");
assertNotNull(report);
assertEquals(3, report.getEntries().size());
conn.update("CLEAR ALL");
}
}
use of org.apache.jena.shacl.ValidationReport in project jena by apache.
the class TestFusekiShaclValidation method shacl_union_1.
@Test
public void shacl_union_1() {
try (RDFConnection conn = RDFConnection.connect(serverURL + "/ds")) {
conn.put(DIR + "data1.ttl");
ValidationReport report = validateReport(serverURL + "/ds/shacl?graph=union", DIR + "shapes1.ttl");
assertNotNull(report);
// Union does not include the storage default graph
assertEquals(0, report.getEntries().size());
conn.update("CLEAR ALL");
}
}
use of org.apache.jena.shacl.ValidationReport in project jena by apache.
the class TestFusekiShaclValidation method shacl_union_2.
@Test
public void shacl_union_2() {
try (RDFConnection conn = RDFConnection.connect(serverURL + "/ds")) {
conn.put("urn:abc:graph", DIR + "data1.ttl");
ValidationReport report = validateReport(serverURL + "/ds/shacl?graph=union", DIR + "shapes1.ttl");
assertNotNull(report);
assertEquals(3, report.getEntries().size());
conn.update("CLEAR ALL");
}
}
Aggregations