o-development / ldo-legacy

Linked Data Objects
Other
19 stars 2 forks source link

rdf:type is handled wrong #21

Closed megoth-capgemini closed 1 year ago

megoth-capgemini commented 1 year ago

Similar to https://github.com/o-development/ldo/issues/18, but for rdf:type instead. Currently, the following ShEx code:

PREFIX selaw: <https://riksdagen.se/ontologies/selaw.ttl#>

shape:LegalDocument {
  rdf:type [ selaw:LegalDocument ] ;
  dct:title xsd:string ;
  dct:hasPart @shape:Chapter* ;
}

Outputs the following part in .context.ts:

  type: {
    "@id": "@type",
    "@container": "@set",
  },

This returns undefined when calling doc.type["@id"] in my code. But if I change .context.ts to:

  type: {
    "@id": "@type",
    "@type": "@id",
  },

It works as intended, except that it returns LegalDocument instead of https://riksdagen.se/ontologies/selaw.ttl#LegalDocument. But I can work with this for now.

megoth-capgemini commented 1 year ago

To provide a bit more context, this is (currently) the latest version of law.shex:

PREFIX dct:   <http://purl.org/dc/terms/>
PREFIX rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:  <http://www.w3.org/2000/01/rdf-schema#>
PREFIX selaw: <https://riksdagen.se/ontologies/selaw.ttl#>
PREFIX xsd:   <http://www.w3.org/2001/XMLSchema#>
PREFIX shape: <https://riksdagen.se/shapes#>

shape:LegalDocument {
  rdf:type [ selaw:LegalDocument ] ;
  dct:title xsd:string ;
  dct:hasPart @shape:Chapter* ;
}

shape:Chapter {
  rdf:type [ selaw:Chapter ] ;
  dct:title xsd:string ;
  selaw:referenceNumber xsd:string ;
  dct:hasPart @shape:Section* ;
  dct:hasPart @shape:Paragraph* ;
}

shape:Section {
  rdf:type [ selaw:Section ] ;
  dct:title xsd:string ;
  dct:hasPart @shape:Paragraph* ;
}

shape:Paragraph {
  rdf:type [ selaw:Paragraph ] ;
  rdf:value xsd:string ;
  selaw:referenceNumber xsd:string ;
  dct:hasPart @shape:ListItem* ;
}

shape:ListItem {
  rdf:type [ selaw:ListItem ] ;
  rdf:value xsd:string ;
  selaw:referenceNumber xsd:string ;
}

Also, I'm working on ldo@1.0.3 and ldo-cli@3.0.1.

jaxoncreed commented 1 year ago

Indeed. This would be fixed when #18 is fixed.