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

    https://github.com/apache/jena/pull/89#discussion_r35211501
  
    --- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/engine/QueryExecutionBase.java ---
    @@ -242,6 +257,49 @@ public Model execConstruct(Model model)
             Template template = query.getConstructTemplate() ;
             return TemplateLib.calcTriples(template.getTriples(), 
queryIterator);
         }
    +    
    +    @Override
    +    public Iterator<Quad> execConstructQuads()
    +    {
    +        checkNotClosed() ;
    +        if ( ! query.isConstructType() )
    +            throw new QueryExecException("Attempt to get a CONSTRUCT model 
from a "+labelForQuery(query)+" query") ;
    +        // This causes there to be no PROJECT around the pattern.
    +        // That in turn, exposes the initial bindings.  
    +        if ( ! Syntax.syntaxARQ.equals( query.getSyntax() ) )
    +           throw new QueryExecException("Attempt to CONSTRUCT quads from a 
"+labelForQuery(query)+" query, which is not ARQ Syntax") ;
    +           
    +        query.setQueryResultStar(true) ;
    +
    +        startQueryIterator() ;
    +        
    +        Template template = query.getConstructTemplate() ;
    +        return TemplateLib.calcQuads(template.getQuads(), queryIterator);
    +    }
    +    
    +    @Override
    +    public Dataset execConstructDataset(){
    +           
    +           DatasetGraph graph = DatasetGraphFactory.createMem();
    +           
    +        checkNotClosed() ;
    +        try
    +        {
    +            Iterator<Quad> it = execConstructQuads();
    +                        
    +            while (it.hasNext())
    +            {
    +                Quad q = it.next();
    +                graph.add(q);
    --- End diff --
    
    Given Java 8 this iterator loop could be just 
`execConstructQuads().forEachRemaining(graph::add);`


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to