Skip to content

Missing variables in method to_sparql #47

Open
@danielhz

Description

@danielhz

I tested the following code with sparql 3.2.5:

require 'sparql'

exp = <<-EOS
(extend ((?a1 "a1") (?a2 "a2"))
	(union
	 (extend
	  ((?a2 "a3") (?a4 "a4"))
	  (join (extend
		 ((?a5 "a5") (?a6 "a6"))
		 (bgp (triple ?s1 ?p1 ?o1) (triple ?s2 ?p2 ?o2) (triple ?s3 ?p3 ?o3)))
		(extend
		 ((?a7 "a7") (?a8 "a8"))
		 (bgp (triple ?s4 ?p4 ?o4) (triple ?s5 ?p5 ?o5)))))
	 (extend ((?a9 "a9") (?a10 "a10")) (bgp (triple ?s6 ?p6 ?o6)))))
EOS

puts SPARQL::Algebra.parse(exp).to_sparql

I expect a query where the variables ?a3 and ?a4. However, in the output listed below, variables ?a3 and ?a4 do not appear.

SELECT *
WHERE {
{
{
{?s1 ?p1 ?o1 . 
?s2 ?p2 ?o2 . 
?s3 ?p3 ?o3 . 

BIND ("a5" AS ?a5) .
BIND ("a6" AS ?a6) .}
{
{?s4 ?p4 ?o4 . 
?s5 ?p5 ?o5 . 

BIND ("a7" AS ?a7) .
BIND ("a8" AS ?a8) .}
}
}
} UNION {
{?s6 ?p6 ?o6 . 

BIND ("a1" AS ?a1) .
BIND ("a2" AS ?a2) .
BIND ("a9" AS ?a9) .
BIND ("a10" AS ?a10) .}
}
BIND ("a1" AS ?a1) .
BIND ("a2" AS ?a2) .
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions