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.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to