ruby-rdf / sparql

Ruby SPARQL library
http://rubygems.org/gems/sparql
The Unlicense
88 stars 14 forks source link

Invalid SPARQL parsing #33

Closed abrisse closed 5 years ago

abrisse commented 5 years ago

Ruby version : 2.4.4p296 Gem version: 3.0.1


require 'sparql'

query = %(
  CONSTRUCT {
      ?uri <http://prop3> ?anotherURI .
  }
  WHERE
  {
      ?uri a ?type ;
        <http://prop1> / <http://prop2> ?anotherURI
  }
)

SPARQL.parse(query)

Current behaviour:

Produce

(construct 
  ((triple ?uri <http://prop3> ?anotherURI)) 
  (bgp (triple ?uri a ?type) (triple ?uri a ?anotherURI))
)

Expected behaviour:

Should produce instead

(construct
  ((triple ?uri <http://prop3> ?anotherURI)) 
  (join
   (bgp (triple ?uri a ?type)) 
   (path ?uri (seq <http://prop1> <http://prop2>) ?anotherURI)
  )
)