Not logged in : Login
(Sponging disallowed)

About: VirtJenaSPARQLExample11     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%2FVirtJenaSPARQLExample11

AttributesValues
has container
Date Created
maker
topic
described by
seeAlso
Date Modified
link
id
  • 105aae72345b726a7d808b8818a3f592
content
  • %VOSWARNING% %META:TOPICPARENT{name="VirtJenaProvider"}% ---+ Virtuoso Jena Provider - SPARQL Example 11 <verbatim> import com.hp.hpl.jena.query.*; import com.hp.hpl.jena.rdf.model.*; import com.hp.hpl.jena.query.DataSource; import com.hp.hpl.jena.util.iterator.*; import com.hp.hpl.jena.graph.*; import com.hp.hpl.jena.graph.test.*; import java.util.*; import virtuoso.jena.driver.*; public class VirtuosoSPARQLExample11 { /** * 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 */ VirtDataSource ds = new VirtDataSource(url, "dba", "dba"); Model md = ds.getNamedModel("gr"); Statement st; st = statement( md, "D E F" ); md.add(st); st = statement( md, "A B C" ); md.add(st); StmtIterator it = md.listStatements(); while(it.hasNext()) { st = it.nextStatement(); System.out.println(st); } } public static Statement statement( Model m, String fact ) { StringTokenizer st = new StringTokenizer( fact ); Resource sub = resource( m, st.nextToken() ); Property pred = property( m, st.nextToken() ); RDFNode obj = rdfNode( m, st.nextToken() ); return m.createStatement( sub, pred, obj ); } public static Resource resource( Model m, String s ) { return (Resource) rdfNode( m, s ); } public static Property property( Model m, String s ) { return (Property) rdfNode( m, s ).as( Property.class ); } public static RDFNode rdfNode( Model m, String s ) { return m.asRDFNode( NodeCreateUtils.create( m, s ) ); } } </verbatim>
Title
  • VirtJenaSPARQLExample11
has creator
is described using
atom:source
atom:updated
  • 2014-04-29T00:54:18Z
atom:title
  • VirtJenaSPARQLExample11
atom:author
label
  • VirtJenaSPARQLExample11
topic
atom:published
  • 2011-08-18T11:11:16Z
type
is topic of
is interest of
is made of
is link of
is creator of 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