Search code examples
rubysparqlrdf

Ruby SPARQL Client with Property Path Unary * Operator syntax


This SPARQL query example works fine:

require 'sparql/client'
rdfs_vocabulary = RDF::Vocabulary.new("http://www.w3.org/2000/01/rdf-schema#")
sparql_client.select.where(:x, rdfs_vocabulary.subClassOf, :type)

Extending it with the Property Path * operator to get all subclasses, the following syntax works as well:

sparql_client.select.where(:x, "<http://www.w3.org/2000/01/rdf-schema#subClassOf>*", :type)

but is it possible to avoid the full-URI?


Solution

  • Try sparql_client.select.where([:x, [RDF::RDFS.subClassOf,"*"], :type]).

    See query_spec.rb. Related GitHub issue.