Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difficult to determine enumeration types from generated OWL/SHACL file #163

Open
goneall opened this issue Dec 3, 2024 · 0 comments
Open

Comments

@goneall
Copy link
Member

goneall commented Dec 3, 2024

Context: to generate the Java code from the OWL/SHACL file, we need to determine if a particular class is an enumeration type

Based on the information available in the OWL/SHACL file, we would have to find all property references to the class and do some rather messy heuristics to determine if a particular class is an Enum class.

Suggestion is to add some information at the class level to more accurately and easily determine if a class represents an Enum with a limited range of values.

Currently, it looks like the only hints as to whether a class is an Enum class is in the properties whose range is that class.

Details:

The current generated file only has basic information for a class containing only enumerated values. For example, HashAlgorithm is defined only containing the comment:

ns2:HashAlgorithm a owl:Class ;
    rdfs:comment "A mathematical algorithm that maps data of arbitrary size to a bit string."@en .

The individuals defined for that class can be a hint, but they only have a label and a comment. Example:

<https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/adler32> a owl:NamedIndividual,
        ns2:HashAlgorithm ;
    rdfs:label "adler32" ;
    rdfs:comment "Adler-32 checksum is part of the widely used zlib compression library as defined in [RFC 1950](https://datatracker.ietf.org/doc/rfc1950/) Section 2.3."@en .

The properties which are limited to the class do provide a restriction which can be useful.

Example:

ns2:Hash a owl:Class,
        sh:NodeShape ;
    rdfs:comment "A mathematically calculated representation of a grouping of data."@en ;
    rdfs:subClassOf ns2:IntegrityMethod ;
    sh:nodeKind sh:BlankNode ;
    sh:property [ sh:datatype xsd:string ;
            sh:maxCount 1 ;
            sh:minCount 1 ;
            sh:nodeKind sh:Literal ;
            sh:path ns2:hashValue ],
        [ sh:class ns2:HashAlgorithm ;
            sh:in ( <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/adler32> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b256> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b384> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b512> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake3> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/crystalsDilithium> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/crystalsKyber> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/falcon> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md2> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md4> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md5> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md6> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/other> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha1> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha224> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha256> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha384> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha512> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_224> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_256> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_384> <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_512> ) ;
            sh:maxCount 1 ;
            sh:minCount 1 ;
            sh:nodeKind sh:IRI ;
            sh:path ns2:algorithm ] .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant