Ruby SPARQL Client with Property Path Unary * Oper

2019-07-25 02:40发布

问题:

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?

回答1:

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

See query_spec.rb. Related GitHub issue.



标签: ruby sparql rdf