Skip to content

Issue deleting RDF list #55

@u0078867

Description

@u0078867

I have the following triples in a RDF::Repository:

_:g183184 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:g183184 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g183192 .
_:g183192 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "2"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:g183192 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g183200 .
_:g183200 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "3"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:g183200 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
<http://example.org/my_list_1> <http://example.org/contains> _:g183184 .
_:g183208 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "4"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:g183208 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g183216 .
_:g183216 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "5"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:g183216 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g183224 .
_:g183224 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "6"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:g183224 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
<http://example.org/my_list_2> <http://example.org/contains> _:g183208 .

I would like to delete the first list by using the following query in client.update(...):

PREFIX ex:  <http://example.org/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

DELETE {
  ?z rdf:first ?head ;
     rdf:rest ?tail .
} WHERE {
  ex:my_list_1 ex:contains ?list .
  ?list rdf:rest* ?z .
  ?z rdf:first ?head ;
     rdf:rest ?tail .
}

But it throws:

/home/davide/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/sparql-3.3.0/lib/sparql/algebra/operator/sequence.rb:51:in 'SPARQL::Algebra::Operator::Sequence#execute': undefined local variable or method 'block' for an instance of SPARQL::Algebra::Operator::Sequence (NameError)

        @solutions.each(&block) if block_given?
                         ^^^^^
	from /home/davide/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/rdf-3.3.3/lib/rdf/mixin/queryable.rb:131:in 'RDF::Queryable#query_execute'
	from /home/davide/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/sparql-3.3.0/lib/sparql/algebra/extensions.rb:328:in 'RDF::Queryable#query'
	from /home/davide/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/sparql-3.3.0/lib/sparql/algebra/operator/modify.rb:74:in 'SPARQL::Algebra::Operator::Modify#execute'
	from /home/davide/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/sparql-3.3.0/lib/sparql/algebra/operator/update.rb:71:in 'block in SPARQL::Algebra::Operator::Update#execute'
	from /home/davide/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/sparql-3.3.0/lib/sparql/algebra/operator/update.rb:70:in 'Array#each'
	from /home/davide/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/sparql-3.3.0/lib/sparql/algebra/operator/update.rb:70:in 'SPARQL::Algebra::Operator::Update#execute'
	from /home/davide/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/sparql-3.3.0/lib/sparql.rb:94:in 'SPARQL.execute'
	from /home/davide/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/sparql-client-3.3.0/lib/sparql/client.rb:359:in 'SPARQL::Client#update'

The complains seems to be at the asterisk in rdf:rest*.

sparql gem version is 3.3.0.

Any idea?

Thank you!

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