ruby-rdf / shex

The Unlicense
12 stars 2 forks source link

Error when executing code sample #4

Closed PMAxelDelsol closed 2 years ago

PMAxelDelsol commented 2 years ago

The error undefined method 'lexical=' for #<RDF::URI:0x000055e00d5719d8> (NoMethodError) is raised when trying to execute the following code (extracted from the README).

The rdf gem version used is 3.1.15. I also add the stack trace in the issue, hopefully it can help. stack_trace.txt

# frozen_string_literal: true

require 'rdf/turtle'
require 'shex'

shexc =  %(
  PREFIX doap:  <http://usefulinc.com/ns/doap#>
  PREFIX dc:    <http://purl.org/dc/terms/>
  <TestShape> EXTRA a {
    a doap:Project;
    (doap:name;doap:description|dc:title;dc:description)+;
    doap:category*;
    doap:developer IRI;
    doap:implements    [<http://shex.io/shex-semantics/>]
  }
)

graph = RDF::Graph.load("etc/doap.ttl")
schema = ShEx.parse(shexc)
map = {
  "https://rubygems.org/gems/shex" => "TestShape"
}
schema.satisfies?("https://rubygems.org/gems/shex", graph, map)
gkellogg commented 2 years ago

Looks like a missing dependency that is satisfied when running through the bundler. I’ll check it out.

gkellogg commented 2 years ago

@PMAxelDelsol although there were some other minor issues this exposed, the main problems were that the examples were out of date. Try again from the develop branch of the repo and I can release an updated gem.

PMAxelDelsol commented 2 years ago

I confirm everything works perfectly from the develop branch.

Thank you very much !