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
24 stars 4 forks source link

Restriction on controlled vocabularies #192

Open andreea-pasare opened 8 months ago

andreea-pasare commented 8 months ago

Decide what to do with SHACL shapes restricted to a controlled vocabulary "class":

  1. move that class definition from restriction artefact into shape artefact
  2. abandon class definition and find an alternative solution in SHACL
cristianvasquez commented 1 month ago

Hi @andreea-pasare , could you please elaborate on the description of this issue?

cristianvasquez commented 1 month ago

After looking at the issue again, maybe you are referring to the elements marked as 'Enumeration' in UML.

I would export them as follows:

Say we have a epo:Item that uses a4g:hasCountryOfOrigin to connect with one atold:country that in the UML is declared as an enum. If that is the case, the property in SHACL could be:

a4g_shape:Item-hasCountryOfOrigin-country a shacl:PropertyShape ;
    shacl:path a4g:hasCountryOfOrigin ;
    shacl:name "has country of origin"@en ;
    shacl:maxCount 1 ;
    shacl:node [
        rdf:type shacl:NodeShape ;
        shacl:property [
            shacl:path skos:inScheme ;
            shacl:hasValue atold:country ;
        ] ;
    ] ;
    shacl:nodeKind shacl:IRI .

Note that the expected value is 'something' that has skos:inScheme atold:country

There are other ways, such as specifying the elements. But this one seems straightforward

cristianvasquez commented 1 month ago

Maybe if such enum specify the values, say the ex:color, that has (in the UML) the declared values ex:Pink end ex:Purple, they might be exported using sh:in

ex:InExampleShape
    a sh:NodeShape ;
    sh:targetNode ex:RainbowPony ;
    sh:property [
        sh:path ex:color ;
        sh:in ( ex:Pink ex:Purple ) ;
    ] .