Not logged in : Login

About: VirtJenaSPARQLExample2     Goto   Sponge   NotDistinct   Permalink

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

AttributesValues
type
Date Created
Date Modified
label
  • VirtJenaSPARQLExample2
maker
Title
  • VirtJenaSPARQLExample2
isDescribedUsing
has creator
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>
id
  • 2852f31c14aaf3f48b0d53a3f67d551d
link
has container
http://rdfs.org/si...ices#has_services
atom:title
  • VirtJenaSPARQLExample2
atom:source
atom:author
atom:published
  • 2017-06-13T05:45:20Z
atom:updated
  • 2017-06-13T05:45:20Z
topic
is made of
is container of of
is link of
is http://rdfs.org/si...vices#services_of of
is links to 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, 772 MB memory in use)
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2025 OpenLink Software