Not logged in : Login

About: VirtJenaSPARQLExample8     Goto   Sponge   NotDistinct   Permalink

An Entity of Type : atom:Entry, within Data Space : vos.openlinksw.com associated with source document(s)

AttributesValues
type
Date Created
Date Modified
label
  • VirtJenaSPARQLExample8
maker
Title
  • VirtJenaSPARQLExample8
isDescribedUsing
has creator
content
  • import org.apache.jena.query.*; import org.apache.jena.rdf.model.RDFNode; import virtuoso.jena.driver.*; public class VirtuosoSPARQLExample8 { /** * Executes a SPARQL query against a virtuoso url and prints results. */ public static void main(String[] args) { String url; if(args.length == 0) url = "jdbc:virtuoso://localhost:1111"; else url = args[0]; /* STEP 1 */ VirtGraph set = new VirtGraph (url, "dba", "dba"); /* STEP 2 */ System.out.println("\nexecute: CLEAR GRAPH "); String str = "CLEAR GRAPH "; VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.create(str, set); vur.exec(); System.out.println("\nexecute: INSERT INTO GRAPH { 'cc' . 123. }"); str = "INSERT INTO GRAPH { 'cc' . 123. }"; vur = VirtuosoUpdateFactory.create(str, set); vur.exec(); /* STEP 3 */ /* Select all data in virtuoso */ System.out.println("\nexecute: SELECT * FROM WHERE { ?s ?p ?o }"); Query sparql = QueryFactory.create("SELECT * FROM WHERE { ?s ?p ?o }"); /* STEP 4 */ QueryExecution vqe = VirtuosoQueryExecutionFactory.create (sparql, set); ResultSet results = vqe.execSelect(); while (results.hasNext()) { QuerySolution rs = results.nextSolution(); RDFNode s = rs.get("s"); RDFNode p = rs.get("p"); RDFNode o = rs.get("o"); System.out.println(" { " + s + " " + p + " " + o + " . }"); } System.out.println("\nexecute: DELETE FROM GRAPH { 'cc' }"); str = "DELETE FROM GRAPH { 'cc' }"; vur = VirtuosoUpdateFactory.create(str, set); vur.exec(); System.out.println("\nexecute: SELECT * FROM WHERE { ?s ?p ?o }"); vqe = VirtuosoQueryExecutionFactory.create (sparql, set); results = vqe.execSelect(); while (results.hasNext()) { QuerySolution rs = results.nextSolution(); RDFNode s = rs.get("s"); RDFNode p = rs.get("p"); RDFNode o = rs.get("o"); System.out.println(" { " + s + " " + p + " " + o + " . }"); } } }
id
  • 3b9ae178b00c177b6a748002653025cc
link
has container
http://rdfs.org/si...ices#has_services
atom:title
  • VirtJenaSPARQLExample8
atom:source
atom:author
atom:published
  • 2018-11-24T15:49:24Z
atom:updated
  • 2018-11-24T15:52:19Z
topic
is made of
is container of of
is link of
is http://rdfs.org/si...vices#services_of of
is creator of of
is atom:entry of
is atom:contains of
Faceted Search & Find service v1.17_git150 as of Jan 20 2025


Alternative Linked Data Documents: iSPARQL | ODE     Content Formats:   [cxml] [csv]     RDF   [text] [turtle] [ld+json] [rdf+json] [rdf+xml]     ODATA   [atom+xml] [odata+json]     Microdata   [microdata+json] [html]    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 08.03.3332 as of Sep 11 2024, on Linux (x86_64-generic-linux-glibc25), Single-Server Edition (15 GB total memory, 1 GB memory in use)
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2025 OpenLink Software