spdx / spdx/spec-parser

Context file: Set @type to @id for terms that refer to a class

Open
#204 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

In the context file, use @id as the @type for any term where the range is a class.

For example, for createBy, which its range is Agent class, its entry in context file should look like this:

    "createdBy": {
      "@id": "https://spdx.org/rdf/3.1/terms/Core/createdBy",
      "@type": "@id"
    },

Currently we set the type as @vocab, but Agent is not a vocabulary.

Propose to change these lines:

https://github.com/spdx/spec-parser/blob/fb5800c9e13a805660773886dec3a8c587355951/spec_parser/rdf.py#L276-L280

to:

        elif (o, RDF.type, OWL.Class) in g:
            return {
                "@id": subject,
                "@type": "@id",
            }

o here is not a vocabulary, because line 268, and it is a class, because line 276:

https://github.com/spdx/spec-parser/blob/fb5800c9e13a805660773886dec3a8c587355951/spec_parser/rdf.py#L267-L280

Ref: https://github.com/spdx/spdx-3-model/issues/1167

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

Start in spec_parser/rdf.py around lines 267-280 and inspect how context entries are generated for ranges that are vocabulary terms versus OWL classes. Update the class-handling branch so class ranges produce the proposed @id type, then verify that generated context entries such as createdBy use @type set to @id.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.