OP-TED / model2owl

Transform UML into a formal OWL ontology and SHACL shapes
https://meaningfy-ws.github.io/model2owl-docs
European Union Public License 1.2
28 stars 5 forks source link

Handle rdf:plainliteral in the exported SHACL #219

Open cristianvasquez opened 2 months ago

cristianvasquez commented 2 months ago

The ePO ontology produces SHACL with references to rdf:plainliteral, that is either a xsd:string or rdf:langString like in this example

core-shape:org-Organization-epo-hasLegalFormType a sh:PropertyShape ;
    rdfs:isDefinedBy core-shape:core-shape ;
    sh:datatype rdf:PlainLiteral ;
    sh:maxCount 1 ;
    sh:name "Has legal form type" ;
    sh:path :hasLegalFormType .

However, this is not recognized by most SHACL engines

A mechanism is needed to export SHACL that can be used by such engines.

One option is to export something like this:

core-shape:org-Organization-epo-hasLegalFormType a sh:PropertyShape ;
    rdfs:isDefinedBy core-shape:core-shape ;
    sh:maxCount 1 ;
    sh:name "Has legal form type" ;
    sh:path :hasLegalFormType ;
    sh:or (
        [ sh:datatype xsd:string ]
        [ sh:datatype rdf:langString ]
    ) .

Alternatively declare a sh:NodeShape, in this case, the a a4g_shape:PlainLiteral

a4g_shape:PlainLiteral a sh:NodeShape ;
    sh:or (
        [ sh:datatype xsd:string ]
        [ sh:datatype rdf:langString ]
    ) .

So it can be used as

sh:node a4g_shape:PlainLiteral

Related: https://github.com/OP-TED/ted-rdf-mapping-eforms/issues/20

cristianvasquez commented 1 month ago

related: https://github.com/OP-TED/ted-rdf-mapping/issues/407