Difficult to determine enumeration types from generated OWL/SHACL file

Aperta
#163 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
java, python
Ambito
tooling

Direzione di ricerca

Inizia esaminando il flusso di generazione di spec-parser e gli esempi OWL/SHACL nell’issue, in particolare la classe HashAlgorithm e la restrizione della proprietà Hash. Determina come debba essere rappresentato un marker di enum a livello di classe e come il codice Java generato possa utilizzarlo; il lavoro è completo quando le classi enum possono essere identificate senza euristiche basate sui riferimenti alle proprietà.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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 ] .
Lingua principale
Python
Stelle
11
Fork
13
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di spdx/spec-parser

Tutte le issue di spdx/spec-parser

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.