You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Adrika Mukherjee (Jira)" <ji...@apache.org> on 2020/08/27 18:19:00 UTC

[jira] [Comment Edited] (JENA-1952) Jena support for SPARQL*

    [ https://issues.apache.org/jira/browse/JENA-1952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17186030#comment-17186030 ] 

Adrika Mukherjee edited comment on JENA-1952 at 8/27/20, 6:18 PM:
------------------------------------------------------------------

For the following data.ttl file:

@prefix ex: <[http://example.com/]> .
 @prefix dct: <[http://purl.org/dc/terms/]> .
 @prefix foaf: <[http://xmlns.com/foaf/0.1/]> .
 @prefix xsd: <[http://www.w3.org/2001/XMLSchema#]> .
 @prefix rdf: <[http://www.w3.org/1999/02/22-rdf-syntax-ns#]> .

<< ex:book dct:creator ex:alice >> dct:rank 4 .
 << ex:B1 dct:name ex:paul >> dct:rank 1 .
 << ex:B2 dct:name ex:john >> dct:rank 4 .
 << ex:B2 dct:email ex:johnacdedu >> dct:rank 3 .
 << ex:B3 dct:name ex:George >> dct:rank 2 .
 << ex:B3 dct:webPage ex:wwwgeorgeedu >> dct:rank 1 .
 << ex:B4 dct:name ex:ringo >> dct:rank 3 .
 << ex:B4 dct:email ex:ringoacdedu >> dct:rank 2 .
 << ex:B4 dct:webPage ex:wwwstarredu >> dct:rank 4 .

I am using the following piece of code:

String prefixes = "PREFIX ex: <[http://example.com/]> "String prefixes = "PREFIX ex: <[http://example.com/]> " + "PREFIX dct: <[http://purl.org/dc/terms/]> "  + "PREFIX foaf: <[http://xmlns.com/foaf/0.1/]> ";

String queryString = prefixes + "SELECT ?o WHERE \{<<ex:book dct:creator ?o>> dct:rank  4}";

ParserARQ parser = new ParserARQ();

Query query = parser.parse(new Query(), queryString);

String filename1 = "data.ttl";

Graph g = ModelFactory.createDefaultModel().getGraph();

StreamRDF dest = StreamRDFLib.graph(g);

RDFParser.create()    

                 .source( "file://" + filename1 )    

                 .checking(false) 

                 .parse(dest);

Model m = ModelFactory.createModelForGraph(g);

ResultSet rs = QueryExecutionFactory.create(query, m).execSelect();

ResultSetFormatter.out(System.out, rs);

 

Any variable inside the embedded triple does not seem to return data. Is there any way out?


was (Author: adrikamukherjee):
For the following data.ttl file:

@prefix ex: <http://example.com/> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .


<< ex:book dct:creator ex:alice >> dct:rank 4 .
<< ex:B1 dct:name ex:paul >> dct:rank 1 .
<< ex:B2 dct:name ex:john >> dct:rank 4 .
<< ex:B2 dct:email ex:johnacdedu >> dct:rank 3 .
<< ex:B3 dct:name ex:George >> dct:rank 2 .
<< ex:B3 dct:webPage ex:wwwgeorgeedu >> dct:rank 1 .
<< ex:B4 dct:name ex:ringo >> dct:rank 3 .
<< ex:B4 dct:email ex:ringoacdedu >> dct:rank 2 .
<< ex:B4 dct:webPage ex:wwwstarredu >> dct:rank 4 .

I am using the following piece of code:

String prefixes = "PREFIX ex: <http://example.com/> "String prefixes = "PREFIX ex: <http://example.com/> " + "PREFIX dct: <http://purl.org/dc/terms/> "  + "PREFIX foaf: <http://xmlns.com/foaf/0.1/> ";

String queryString = prefixes + "SELECT ?o WHERE \{<<ex:book dct:creator ?o>> dct:rank  4}";

ParserARQ parser = new ParserARQ();

Query query = parser.parse(new Query(), queryString);

String filename1 = "data.ttl";

Graph g = ModelFactory.createDefaultModel().getGraph();

StreamRDF dest = StreamRDFLib.graph(g);

RDFParser.create()    

                 .source( "file://" + filename1 )    

                 .checking(false) 

                 .parse(dest);

Model m = ModelFactory.createModelForGraph(g);

ResultSet rs = QueryExecutionFactory.create(query, m).execSelect();

ResultSetFormatter.out(System.out, rs);

> Jena support for SPARQL*
> ------------------------
>
>                 Key: JENA-1952
>                 URL: https://issues.apache.org/jira/browse/JENA-1952
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ
>    Affects Versions: Jena 3.16.0
>            Reporter: Adrika Mukherjee
>            Priority: Major
>
> SPARQL * does not able to return variables on embedded triples. For example : "SELECT ?o ?o1 WHERE \{<<?s ?p ?o>> dct:rank ?o1}"; this query does not work.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)