o-development / ldo

Monorepo for Linked Data Objects (ldo)
MIT License
31 stars 6 forks source link

Strange error when I tried to generate LDO Documents base on fhir.shex #51

Open chuixuewan opened 4 months ago

chuixuewan commented 4 months ago

I downloaded the fhir.shex from https://www.hl7.org/fhir/downloads.html, I added the fhir.shex file to the .shapes folder and after I ran "npm run build:ldo" I met this error " Generating LDO DocumentsC:\test_project\fhir\node_modules\@ldo\schema-converter-shex\dist\typing\ShexJTypingTransformer.js:68 throw new Error("Cannot handle ShapeOr, ShapeAnd, ShapeNot, ShapeExternal, or NodeConstraint"); ^

Error: Cannot handle ShapeOr, ShapeAnd, ShapeNot, ShapeExternal, or NodeConstraint at Object.transformer (C:\test_project\fhir\node_modules\@ldo\schema-converter-shex\dist\typing\ShexJTypingTransformer.js:68:23) at runNextTicks (node:internal/process/task_queues:60:5) at listOnTimeout (node:internal/timers:540:9) at process.processTimers (node:internal/timers:514:7) at async C:\test_project\fhir\node_modules\@ldo\type-traverser\dist\transformerSubTraversers\TransformerInterfaceSubTraverser.js:12:39

Node.js v20.14.0" I do not know what's going on over here.

chuixuewan commented 4 months ago

can we write shex file import other shex file? like this : nameShape.shex

PREFIX ex: <http://example.org/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

# Define a shape for the name structure
<NameShape> {
    ex:firstname xsd:string;  # Triple Constraint with a Node Constraint specifying the value must be a string
    ex:lastname xsd:string    # Triple Constraint with a Node Constraint specifying the value must be a string
}

person.shex

PREFIX ex: <http://example.org/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

IMPORT <NameShape.shex>

# Define a shape for the person structure
<PersonShape> {
    ex:name @<NameShape>;     # Triple Constraint referencing the NameShape for the nested name structure
}

I tried this but it doesn't work, do we have any other method to achieve this?