Attributes | Values |
---|
type
| |
Date Created
| |
Date Modified
| |
label
| - VirtJenaSPARQLExample1
- VirtJenaSPARQLExample1
|
seeAlso
| |
maker
| |
Title
| - VirtJenaSPARQLExample1
- VirtJenaSPARQLExample1
|
isDescribedUsing
| |
has creator
| |
content
| - %META:TOPICPARENT{name="VirtJenaProvider"}%
%VOSWARNING%
---+ Virtuoso Jena Provider - SPARQL Example 1
<verbatim>
import com.hp.hpl.jena.query.*;
import com.hp.hpl.jena.rdf.model.RDFNode;
import virtuoso.jena.driver.*;
public class VirtuosoSPARQLExample1 {
/**
* 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 */
/* STEP 3 */
/* Select all data in virtuoso */
Query sparql = QueryFactory.create("SELECT * WHERE { GRAPH ?graph { ?s ?p ?o } } limit 100");
/* STEP 4 */
VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create (sparql, set);
ResultSet results = vqe.execSelect();
while (results.hasNext()) {
QuerySolution result = results.nextSolution();
RDFNode graph = result.get("graph");
RDFNode s = result.get("s");
RDFNode p = result.get("p");
RDFNode o = result.get("o");
System.out.println(graph + " { " + s + " " + p + " " + o + " . }");
}
}
}
</verbatim>
- %META:TOPICPARENT{name="VirtJenaProvider"}%
%VOSWARNING%
---+ Virtuoso Jena Provider - SPARQL Example 1
<verbatim>
import com.hp.hpl.jena.query.*;
import com.hp.hpl.jena.rdf.model.RDFNode;
import virtuoso.jena.driver.*;
public class VirtuosoSPARQLExample1 {
/**
* 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 */
/* STEP 3 */
/* Select all data in virtuoso */
Query sparql = QueryFactory.create("SELECT * WHERE { GRAPH ?graph { ?s ?p ?o } } limit 100");
/* STEP 4 */
VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create (sparql, set);
ResultSet results = vqe.execSelect();
while (results.hasNext()) {
QuerySolution result = results.nextSolution();
RDFNode graph = result.get("graph");
RDFNode s = result.get("s");
RDFNode p = result.get("p");
RDFNode o = result.get("o");
System.out.println(graph + " { " + s + " " + p + " " + o + " . }");
}
}
}
</verbatim>
|
id
| - 435b9cae4dd52770cac95f84d605404a
- 435b9cae4dd52770cac95f84d605404a
|
link
| |
has container
| |
http://rdfs.org/si...ices#has_services
| |
atom:title
| - VirtJenaSPARQLExample1
- VirtJenaSPARQLExample1
|
atom:source
| |
atom:author
| |
atom:published
| - 2017-06-13T05:43:04Z
- 2017-06-13T05:43:04Z
|
atom:updated
| - 2017-06-13T05:43:04Z
- 2017-06-13T05:43:04Z
|
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 | |