Skip to content

Specify spdx prefix names in model Turtle file ("@prefix ns2" -> "@prefix spdx-sw") #157

@bact

Description

@bact

Prefixes for SPDX Profiles in the generate Turtle are currently look like this:

...
@prefix ns1: <https://spdx.org/rdf/3.0.1/terms/Core/> .
@prefix ns2: <https://spdx.org/rdf/3.0.1/terms/Software/> .
@prefix ns3: <https://spdx.org/rdf/3.0.1/terms/Dataset/> .
...
@prefix omg-ann: <https://www.omg.org/spec/Commons/AnnotationVocabulary/> .
@prefix spdx: <https://spdx.org/rdf/3.0.1/terms/> .
...

Which may make it not very convenient when going through the code.

Proposal

We may specify the name of the prefix for each profile or each vocab (only for the vocab that has a lot of entries).
This will make it more convenient to follow the code, and may shorten the code as well.

Suggesting that the gen_rdf_ontology() function in rdf.py can look like this:

    g = Graph()
    g.bind("spdx", Namespace(URI_BASE))
    g.bind("spdx-ai", Namespace(URI_BASE + "AI/"))
    g.bind("spdx-core", Namespace(URI_BASE + "Core/"))
    g.bind("spdx-hash", Namespace(URI_BASE + "Core/HashAlgorithm/"))
    g.bind("spdx-re", Namespace(URI_BASE + "Core/RelationshipType/"))
    ...

Appropriated clear & concise prefix names can be proposed.

The change shouldn't change the behaviour of the model on the machine side, but it should help the human developer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions