[redland-dev] [Rasqal RDF Query Library 0000583]: CONSTRUCT halts at a template triple with unbound variable

Mantis Bug Tracker mantis-bug-sender at librdf.org
Fri Oct 10 05:15:00 EDT 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://bugs.librdf.org/mantis/view.php?id=583 
====================================================================== 
Reported By:                camwebb
Assigned To:                
====================================================================== 
Project:                    Rasqal RDF Query Library
Issue ID:                   583
Category:                   query engine
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
Query Language:             SPARQL 
====================================================================== 
Date Submitted:             2014-10-10 02:14
Last Modified:              2014-10-10 02:14
====================================================================== 
Summary:                    CONSTRUCT halts at a template triple with unbound
variable
Description: 
When I run a SPARQL CONSTRUCT with template triples that may contain unbound
variables (due to OPTIONALs in the WHERE), roqet seems to halt the processing of
the template at the ‘failing’ triple, rather than just skipping it and
moving to the next one, a behavior I would expect from section 10.2 of
<http://www.w3.org/TR/rdf-sparql-query/#construct>: “If any such instantiation
produces a triple containing an unbound variable ..., then that triple is not
included in the output RDF graph.”  Running the same query with Python’s
rdflib produces the expected behavior (see example below).


Steps to Reproduce: 
Data:

    @prefix : <http://example.com/> .
    :A :foo :L, :M, :N .
    :L :bar :X ;
       :bam :Y .
    :M :bar :X .
    :N :bam :Y .

Query:

    PREFIX :   <http://example.com/>
    CONSTRUCT { 
                 ?s :foo ?o .
                 ?o :bar ?r . # if r is unbound...
                 ?o :bam ?m . # this line is not executed in rasqal/roqet 
    }
    WHERE     {
                 ?s :foo ?o .
      OPTIONAL { ?o :bar ?r . }
      OPTIONAL { ?o :bam ?m . }
    }

roqet (0.9.32 with redland 1.0.17) output (unused prefixes omitted):

    @prefix : <http://example.com/> .
    :A
        :foo :L, :M, :N .
    :L
        :bam :Y ;
        :bar :X .
    :M
        :bar :X .

rdflib output (unused prefixes omitted, and formatted to match roqet):

    @prefix : <http://example.com/> .
    :A
        :foo :L, :M, :N .
    :L 
        :bam :Y ;
        :bar :X .
    :M 
        :bar :X .
    :N 
        :bam :Y .

Note this final, expected output triple.


Additional Information: 
Is this a known issue? Apologies if this has come up before - I did search the
archive as well as I was able. This Q aside, thanks so much for a stunningly
useful and solid set of tools!
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-10-10 02:14 camwebb        New Issue                                    
======================================================================



More information about the redland-dev mailing list