spdx / spdx/spec-parser

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

Open
#157 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
11
Forks
13
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open rdf.py and locate gen_rdf_ontology(). Review how the generated Turtle currently assigns prefixes, then define concise names for the SPDX profiles or vocabularies as described in the issue. The work is done when the generated model uses the named prefixes without changing its machine-side behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.