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

ASF GitHub Bot commented on JENA-491:
-------------------------------------

Github user afs commented on a diff in the pull request:

    https://github.com/apache/jena/pull/89#discussion_r35198181
  
    --- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/syntax/Template.java ---
    @@ -52,14 +63,43 @@ public Template(BasicPattern bgp)
     //    public void addTriplePath(int index, TriplePath path)
     //    { throw new ARQException("Triples-only collector") ; }
     
    -
    -    public BasicPattern getBGP()        { return bgp ; }
    -    public List<Triple> getTriples()    { return bgp.getList() ; }
    +    public BasicPattern getBGP()
    +    { 
    +           if (this.bgp != null){
    +                   return this.bgp;
    +           }
    +           BasicPattern bgp = new BasicPattern();
    +           for(Quad q: qp.getQuads()){
    +                   bgp.add(q.asTriple());
    +           }
    +           return bgp;
    +    }
    +    public List<Triple> getTriples()
    +    { 
    +           if(this.bgp != null){
    +                   return this.bgp.getList();
    +           }
    +           List<Triple> triples = new ArrayList<Triple>();
    +           for(Quad q: qp.getQuads()){
    +                   triples.add(q.asTriple());
    +           }
    +           return triples;
    +    }
    +    public List<Quad> getQuads() {
    +           if( this.bgp != null){
    +                   List<Quad> quads = new ArrayList<Quad>();
    +                   for(Triple triple: this.bgp.getList()){
    +                           quads.add( new Quad( 
Quad.defaultGraphNodeGenerated, triple ) ); 
    --- End diff --
    
    Jena is now requiring Java8 -- this can be with streams.


> Extend CONSTRUCT to build quads
> -------------------------------
>
>                 Key: JENA-491
>                 URL: https://issues.apache.org/jira/browse/JENA-491
>             Project: Apache Jena
>          Issue Type: Improvement
>          Components: ARQ, Fuseki
>            Reporter: Andy Seaborne
>              Labels: gsoc, gsoc2015, java, linked_data, rdf, sparql
>
> This would be an extension to SPARQL.
> 1/ Add use of GRAPH inside a CONSTRUCT template see SPARQL Update.
> 2/ Add conneg for quads to Fuseki.
> 3/ New QueryExecution operations execConstructQuads() and 
> execConstructDataset()
> If asked for triples, and the CONSTRUCT generates quads, the named graph 
> items are dropped - that is, only the default graph is returned.  This is for 
> commonality with RIOT.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to