shexjs / shex.js

shex.js javascript package
MIT License
58 stars 17 forks source link

Validating all nodes of type with --node-type fails #68

Open tholiebig opened 4 years ago

tholiebig commented 4 years ago

I could not successfully use this option to validate all nodes of type school:Student with:

shex/bin/validate -x enrollee.shex -d alice-bob.ttl -t http://school.example/#Student -s http://school.example/#Enrollee

This ends up in an error:

aborting: TypeError: loaded.data.getTriplesByIRI is not a function
    at knownType (shex/bin/validate:132:25)
    at Function.parsePassedNode (shex/lib/ShExUtil.js:1555:9)
    at _makeShapeMap (shex/bin/validate:148:35)
    at findNodesAndValidate (shex/bin/validate:212:10)
    at shex/bin/validate:287:17
    at process._tickCallback (internal/process/next_tick.js:68:7)

Whereas validating the single nodes work:

shex/bin/validate -x enrollee.shex -d alice-bob.ttl -n http://example.com/users/Bob -s http://school.example/#Enrollee

enrollee.shex:

PREFIX ex: <http://ex.example/#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX school: <http://school.example/#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>

school:enrolleeAge xsd:integer MinInclusive 13 MaxInclusive 20 

school:Enrollee {
  foaf:age @school:enrolleeAge ;
  ex:hasGuardian IRI {1,2}
}

alice-bob.ttl:

PREFIX ex: <http://ex.example/#>
PREFIX inst: <http://example.com/users/>
PREFIX school: <http://school.example/#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>

inst:Alice a school:Student ;
  foaf:age 23 ;                     
  ex:hasGuardian inst:Person2, inst:Person3 .

inst:Bob a school:Student ;
  foaf:age 15 ;                       
  ex:hasGuardian inst:Person4 .
ericprud commented 4 years ago

oops, sorry about the delay. will bang on this in the next couple of days.

pchampin commented 3 years ago

will bang on this in the next couple of days.

Never write anything like that :smiling_imp:

I bumped into the same problem, btw :wink: