This HTML5 document contains 29 embedded RDF statements represented using HTML+Microdata notation.

The embedded RDF content will be recognized by any processor of HTML5 Microdata.

PrefixNamespace IRI
dctermshttp://purl.org/dc/terms/
atomhttp://atomowl.org/ontologies/atomrdf#
foafhttp://xmlns.com/foaf/0.1/
n5http://vos.openlinksw.com/dataspace/services/wiki/
oplhttp://www.openlinksw.com/schema/attribution#
n2http://vos.openlinksw.com/dataspace/owiki/wiki/VOS/
dchttp://purl.org/dc/elements/1.1/
n13http://vos.openlinksw.com/dataspace/dav#
rdfshttp://www.w3.org/2000/01/rdf-schema#
n4http://rdfs.org/sioc/services#
siocthttp://rdfs.org/sioc/types#
n7http://vos.openlinksw.com/dataspace/person/dav#
n14http://vos.openlinksw.com/dataspace/owiki/wiki/
n9http://vos.openlinksw.com/dataspace/owiki/wiki/VOS/VirtJenaSPARQLExample14/sioc.
rdfhttp://www.w3.org/1999/02/22-rdf-syntax-ns#
n10http://vos.openlinksw.com/dataspace/owiki#
xsdhhttp://www.w3.org/2001/XMLSchema#
n18http://vos.openlinksw.com/dataspace/person/owiki#
siochttp://rdfs.org/sioc/ns#
Subject Item
n7:this
foaf:made
n2:VirtJenaSPARQLExample14
Subject Item
n13:this
sioc:creator_of
n2:VirtJenaSPARQLExample14
Subject Item
n5:item
n4:services_of
n2:VirtJenaSPARQLExample14
Subject Item
n10:this
sioc:creator_of
n2:VirtJenaSPARQLExample14
Subject Item
n14:VOS
sioc:container_of
n2:VirtJenaSPARQLExample14
atom:entry
n2:VirtJenaSPARQLExample14
atom:contains
n2:VirtJenaSPARQLExample14
Subject Item
n2:VirtJenaSPARQLExample14
rdf:type
sioct:Comment atom:Entry
dcterms:created
2017-06-13T05:36:23.181412
dcterms:modified
2017-06-29T07:38:24.592846
rdfs:label
VirtJenaSPARQLExample14
foaf:maker
n7:this n18:this
dc:title
VirtJenaSPARQLExample14
opl:isDescribedUsing
n9:rdf
sioc:has_creator
n13:this n10:this
sioc:content
%VOSWARNING% %META:TOPICPARENT{name="VirtJenaProvider"}% ---+ Virtuoso Jena Provider - SPARQL Example 14 <verbatim> import org.apache.jena.query.*; import org.apache.jena.ontology.*; import org.apache.jena.rdf.model.*; import org.apache.jena.reasoner.ReasonerRegistry; import org.apache.jena.util.PrintUtil; import org.apache.jena.vocabulary.RDFS; /** import org.apache.jena.query.*; import org.apache.jena.graph.Triple; import org.apache.jena.graph.Node; import org.apache.jena.graph.Graph; import org.apache.jena.graph.*; import org.apache.jena.rdf.model.*; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.vocabulary.RDFS; **/ import virtuoso.jena.driver.*; public class VirtuosoSPARQLExample14 { static String URL = "jdbc:virtuoso://localhost:1111"; static final String uid = "dba"; static final String pwd = "dba"; public static void print_model(String header, Model m) { String h = header==null?"Model":header; System.out.println("===========["+h+"]=========="); StmtIterator it = m.listStatements((Resource)null, (Property)null, (RDFNode)null); while(it.hasNext()) { Statement st = it.nextStatement(); System.out.println(st); } System.out.println("============================\n"); } public static void print_model(String header, StmtIterator it) { String h = header==null?"Model iterator":header; System.out.println("===========["+h+"]=========="); while(it.hasNext()) { Statement st = it.nextStatement(); System.out.println(st); } System.out.println("============================\n"); } public static void exec_select(String header, Model m, String query) { String h = header==null?"":header; System.out.println("===========["+h+"]=========="); System.out.println("Exec: "+ query); Query jquery = QueryFactory.create(query) ; QueryExecution qexec = QueryExecutionFactory.create(jquery, m) ; ResultSet results = qexec.execSelect(); ResultSetFormatter.out(System.out, results, jquery); qexec.close(); System.out.println("============================\n"); } public static void main(String[] args) { if (args.length != 0) URL = args[0]; try { test1(); test2(); test3(); test4(); } catch (Exception e) { System.out.println("ERROR Test Failed."); e.printStackTrace(); } } public static void test1() { try { System.out.println("--------------- TEST 1 -------------------"); VirtModel vdata = VirtModel.openDatabaseModel("test:inf1", URL, uid, pwd); vdata.removeAll(); String NS = PrintUtil.egNS; Resource c1 = vdata.createResource(NS + "C1"); Resource c2 = vdata.createResource(NS + "C2"); Resource c3 = vdata.createResource(NS + "C3"); vdata.add(c2, RDFS.subClassOf, c3); InfModel im = ModelFactory.createInfModel(ReasonerRegistry.getRDFSReasoner(), vdata); print_model("Data in DB", vdata); print_model("Data in Inferenced Model", im); Model premise = ModelFactory.createDefaultModel(); premise.add(c1, RDFS.subClassOf, c2); print_model("Test listStatements",im.listStatements(c1, RDFS.subClassOf, null, premise)); } catch (Exception e) { System.out.println("ERROR Test Failed."); e.printStackTrace(); } } public static void test2() { try { System.out.println("--------------- TEST 2 -------------------"); VirtModel vdata = VirtModel.openDatabaseModel("test:inf2", URL, uid, pwd); vdata.removeAll(); String NS = PrintUtil.egNS; Resource c1 = vdata.createResource(NS + "C1"); Resource c2 = vdata.createResource(NS + "C2"); Resource c3 = vdata.createResource(NS + "C3"); vdata.add(c2, RDFS.subClassOf, c3); OntModel om = ModelFactory.createOntologyModel(OntModelSpec.RDFS_MEM_RDFS_INF, vdata); print_model("Data in DB", vdata); print_model("Data in Ontology Model", om); Model premise = ModelFactory.createDefaultModel(); premise.add(c1, RDFS.subClassOf, c2); print_model("Test listStatements",om.listStatements(c1, RDFS.subClassOf, null, premise)); } catch (Exception e) { System.out.println("ERROR Test Failed."); e.printStackTrace(); } } public static void test3() { try { System.out.println("--------------- TEST 3 -------------------"); VirtModel vdata = VirtModel.openDatabaseModel("test:inf3", URL, uid, pwd); vdata.removeAll(); String NS = PrintUtil.egNS; Resource c1 = vdata.createResource(NS + "C1"); Resource c2 = vdata.createResource(NS + "C2"); Resource c3 = vdata.createResource(NS + "C3"); vdata.add(c2, RDFS.subClassOf, c3); vdata.add(c1, RDFS.subClassOf, c2); InfModel im = ModelFactory.createInfModel(ReasonerRegistry.getRDFSReasoner(), vdata); exec_select("Data in DB", vdata, "select * where {?s ?p ?o}"); exec_select("Data in Inferenced Model", im, "select * where {?s ?p ?o}"); exec_select("Data in Inferenced Model", im, "select * where {<"+c1+"> <"+RDFS.subClassOf+"> ?o}"); } catch (Exception e) { System.out.println("ERROR Test Failed."); e.printStackTrace(); } } public static void test4() { try { System.out.println("--------------- TEST 4 -------------------"); VirtModel vdata = VirtModel.openDatabaseModel("test:inf4", URL, uid, pwd); vdata.removeAll(); String NS = PrintUtil.egNS; Resource c1 = vdata.createResource(NS + "C1"); Resource c2 = vdata.createResource(NS + "C2"); Resource c3 = vdata.createResource(NS + "C3"); vdata.add(c2, RDFS.subClassOf, c3); vdata.add(c1, RDFS.subClassOf, c2); OntModel om = ModelFactory.createOntologyModel(OntModelSpec.RDFS_MEM_RDFS_INF, vdata); exec_select("Data in DB", vdata, "select * where {?s ?p ?o}"); exec_select("Data in Ontology Model", om, "select * where {?s ?p ?o}"); exec_select("Data in Ontology", om, "select * where {<"+c1+"> <"+RDFS.subClassOf+"> ?o}"); } catch (Exception e) { System.out.println("ERROR Test Failed."); e.printStackTrace(); } } } </verbatim>
sioc:id
96312fd1de7833f9e747c3db362d2d4c
sioc:link
n2:VirtJenaSPARQLExample14
sioc:has_container
n14:VOS
n4:has_services
n5:item
atom:title
VirtJenaSPARQLExample14
atom:source
n14:VOS
atom:author
n7:this
atom:published
2017-06-13T05:36:23Z
atom:updated
2017-06-29T07:38:24Z
sioc:topic
n14:VOS