Fix checksum encoding issue. Proposal: do not use explicit hexBinary-type declaration in submitted records #351
Labels
No labels
bug
config
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
orinoco/shacl-vue#351
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Currently the RDFlib-LinkML code in dumpthings renders the
notationindlidentifiers:Checksumwith explicit type declaration as python encoded string representation of the represented binary content, i.e.,"41"^^xsd:hexBinarybecomes"b'A'". This happens only if the explicit type declaration,^^xsd:hexBinaryis provided.This underlying issue seems to be that range of
notationisHexBinary, which defines its uri to bexsd:hexBinary. AFAICS the rdf-linkml code does get confused with anxsd:hexBinaryURI, but an instance of a genericHexBinary-class. It uses the URI-registered reader to read the content, yielding a byte-string, but the genericHexBinary-instance methods to emit the content of the byte-string ---which isstr--- resulting in something likeb'A'.This can be fixed by:
HexBinaryin thenotation-range, but usingxsd:hexBinaryinstead.HexBinary-instances in the python code generators^^xsd:hexBinary-type delcaration in the TTL record.Proposed solution: 3: To quickly fix the checksum encoding issue, the explicit hexBinary-type declaration should be removed from the checksum in the submitted TTL-record (this would drop the format check because checksum would be treated as string, but it can be done without re-releasing schemas or adding schema specific code to linkml libraries).
One of the suggested fixes involves changing behaviour in
shacl-vue, I will comment on that here.Even if the
HexBinarytype is specified in LinkML,shacl-vuedoes not see it at all. The incoming SHACL says:Introducing alternative behaviour in
shacl-vuejust for thexsd:HexBinaryliteral seems like a patchy solution. Also, this would have to be applied toshacl-tulip, which has the code that handles saving form inputs to named/literal/blank nodes in the graph, which means unnecessarily changing dependency versions just for a weird edge caseThat being said, one possible other way to address this edge case could be via
shacl-vueconfig using theupdate_shapesoption, by changing the incoming shacl to remove thesh:datatype xsd:hexBinary;from that property shape, or changing it toxsd:string. I am not sure, however, what knock-on effects this might have; it will have to be tested. The shacl shape still has thesh:pattern, i.e. UI-side field validation should still be functional.After looking into this: it doesn't seem to help. I used
update_shapesto change the notation's datatype fromxsd:hexBinarytoxsd:string(at first, setting it tonullcaused the field not to be displayed in the UI). This worked fine in the frontend, but the submission still had thexsd:hexBinaryliteral type included. I think this actually highlights an inconsistency inshacl-vue->shacl-tulip;shacl-tulipis possibly not receiving the changes fromupdate_shapesand hence not taking it into account during submission. I am unsure though whether this was intentional or not: will need more investigation...Either way, it does not help with a workaround solution to the original problem.
update_shapesshould flow through toshacl-tulip#355HexBinary#226A final analysis was posted in orinoco/dump-things-server#226 and it was addressed with https://github.com/psychoinformatics-de/datalad-concepts/pull/552