Checksum notation validation error ignored #219

Open
opened 2026-06-24 05:32:48 +00:00 by mih · 0 comments
Owner

I am investigating orinoco/shacl-vue#351 -- which I believe should be dealt with in dump-things-server.

I made a test schema that has a Thing variant with assigns a range of Checksum to the kind slot. When I submit

{
  "pid": "ex:thing1",
  "kind": {
    "creator": "ex:org1",
    "notation": "some"
  }
}

which is structurally valid, but has an invalid Checksum.notation (should be HexBinary), I get a HTTP200 response and the record posts. However, I see

WARNING:rdflib.term:Failed to convert Literal lexical form to value. Datatype=http://www.w3.org/2001/XMLSchema#hexBinary, Converter=<function _unhexlify at 0x7f899415cfe0>
Traceback (most recent call last):
  File "/home/mih/.local/share/uv/tools/dump-things-service/lib/python3.12/site-packages/rdflib/term.py", line 2262, in _castLexicalToPython
    return conv_func(lexical)  # type: ignore[arg-type]
           ^^^^^^^^^^^^^^^^^^
  File "/home/mih/.local/share/uv/tools/dump-things-service/lib/python3.12/site-packages/rdflib/term.py", line 1847, in _unhexlify
    return unhexlify(value)
           ^^^^^^^^^^^^^^^^
binascii.Error: Non-hexadecimal digit found
INFO:     127.0.0.1:38182 - "POST /collection1/curated/record/Thing HTTP/1.1" 200 OK

This appears to be the root problem. It is just a warning.

Posting

{
  "pid": "ex:thing1",
  "kind": {
    "creator": "ex:org1",
    "notation": "1234567890abcdef"
  }
}

works fine and results in a stored record with no encoding issues.

This record can also be retrieved as TTL properly

@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix dlthings: <https://concepts.datalad.org/s/things/v2/> .
@prefix ex: <http://example.org/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

ex:thing1 a dlthings:Thing ;
    dcterms:type [ a dlthings:Checksum ;
            dcterms:creator ex:org1 ;
            skos:notation "1234567890abcdef"^^xsd:hexBinary ] .
I am investigating https://hub.psychoinformatics.de/orinoco/shacl-vue/issues/351 -- which I believe should be dealt with in dump-things-server. I made a test schema that has a `Thing` variant with assigns a `range` of `Checksum` to the `kind` slot. When I submit ```json { "pid": "ex:thing1", "kind": { "creator": "ex:org1", "notation": "some" } } ``` which is structurally valid, but has an invalid `Checksum.notation` (should be `HexBinary`), I get a HTTP200 response and the record posts. However, I see ``` WARNING:rdflib.term:Failed to convert Literal lexical form to value. Datatype=http://www.w3.org/2001/XMLSchema#hexBinary, Converter=<function _unhexlify at 0x7f899415cfe0> Traceback (most recent call last): File "/home/mih/.local/share/uv/tools/dump-things-service/lib/python3.12/site-packages/rdflib/term.py", line 2262, in _castLexicalToPython return conv_func(lexical) # type: ignore[arg-type] ^^^^^^^^^^^^^^^^^^ File "/home/mih/.local/share/uv/tools/dump-things-service/lib/python3.12/site-packages/rdflib/term.py", line 1847, in _unhexlify return unhexlify(value) ^^^^^^^^^^^^^^^^ binascii.Error: Non-hexadecimal digit found INFO: 127.0.0.1:38182 - "POST /collection1/curated/record/Thing HTTP/1.1" 200 OK ``` This appears to be the root problem. It is just a warning. Posting ```json { "pid": "ex:thing1", "kind": { "creator": "ex:org1", "notation": "1234567890abcdef" } } ``` works fine and results in a stored record with no encoding issues. This record can also be retrieved as TTL properly ``` @prefix dcterms: <http://purl.org/dc/terms/> . @prefix dlthings: <https://concepts.datalad.org/s/things/v2/> . @prefix ex: <http://example.org/> . @prefix skos: <http://www.w3.org/2004/02/skos/core#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . ex:thing1 a dlthings:Thing ; dcterms:type [ a dlthings:Checksum ; dcterms:creator ex:org1 ; skos:notation "1234567890abcdef"^^xsd:hexBinary ] . ```
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
orinoco/dump-things-service#219
No description provided.