Not logged in : Login
(Sponging disallowed)

About: VirtJenaSPARQLExample2     Goto   Sponge   NotDistinct   Permalink

An Entity of Type : atom:Entry, within Data Space : www.openlinksw.com associated with source document(s)
QRcode icon
http://www.openlinksw.com/describe/?url=http%3A%2F%2Fwww.openlinksw.com%2Fdataspace%2Fdav%2Fwiki%2FMain%2FVirtJenaSPARQLExample2

AttributesValues
has container
Date Created
maker
topic
described by
seeAlso
Date Modified
link
id
  • 37ad2fae547be385f23147266ad230ab
content
  • %META:TOPICPARENT{name="VirtJenaProvider"}% %VOSWARNING% ---+ Virtuoso Jena Provider - SPARQL Example 2 <verbatim> import com.hp.hpl.jena.query.*; import com.hp.hpl.jena.rdf.model.RDFNode; import virtuoso.jena.driver.*; public class VirtuosoSPARQLExample2 { /** * 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 graph = new VirtGraph ("Example2", url, "dba", "dba"); /* STEP 2 */ /* Load data to Virtuoso */ graph.clear (); System.out.print ("Begin read from 'http://www.w3.org/People/Berners-Lee/card#i' "); graph.read("http://www.w3.org/People/Berners-Lee/card#i", "RDF/XML"); System.out.println ("\t\t\t Done."); System.out.print ("Begin read from 'http://demo.openlinksw.com/dataspace/person/demo#this' "); graph.read("http://demo.openlinksw.com/dataspace/person/demo#this", "RDF/XML"); System.out.println ("\t Done."); System.out.print ("Begin read from 'http://kidehen.idehen.net/dataspace/person/kidehen#this' "); graph.read("http://kidehen.idehen.net/dataspace/person/kidehen#this", "RDF/XML"); System.out.println ("\t Done."); /* STEP 3 */ /* Select only from VirtGraph */ Query sparql = QueryFactory.create("SELECT ?s ?p ?o WHERE { ?s ?p ?o }"); /* STEP 4 */ VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create (sparql, graph); ResultSet results = vqe.execSelect(); while (results.hasNext()) { QuerySolution result = results.nextSolution(); RDFNode graph_name = result.get("graph"); RDFNode s = result.get("s"); RDFNode p = result.get("p"); RDFNode o = result.get("o"); System.out.println(graph_name + " { " + s + " " + p + " " + o + " . }"); } System.out.println("graph.getCount() = " + graph.getCount()); } } </verbatim>
Title
  • VirtJenaSPARQLExample2
has creator
is described using
atom:source
atom:updated
  • 2014-04-29T00:31:35Z
atom:title
  • VirtJenaSPARQLExample2
atom:author
label
  • VirtJenaSPARQLExample2
topic
atom:published
  • 2010-02-01T14:48:54Z
type
is topic of
is interest of
Faceted Search & Find service v1.17_git122 as of Jan 03 2023


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.3330 as of Apr 5 2024, on Linux (x86_64-generic-linux-glibc25), Single-Server Edition (30 GB total memory, 26 GB memory in use)
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2024 OpenLink Software