Skip to content

Data from parsers should be stored in spdx models only as python types and spdx models #91

Closed
@xavierfigueroav

Description

@xavierfigueroav

When parsing documents from RDF files, some fields are being stored as rdflib objects and it can be problematic.

All data stored in SPDX models (document.Document, file.File, document.ExtractedLicense, etc) should be stored as python and spdx types so that they are independent of the format to be written or read.

I had problems trying to write YAML files from a document instance created by reading an RDF file because pyyaml was not able to represent some rdflib objects (and it does not have to be able to). As expected, pyyaml is able to deal with python objects.

Of course, almost every spdx type has overwritten the __str__ and __repr__ methods and some others have methods that return the 'str' representation of their single fields, but they sometimes assume (correctly) that fields such as full_name, text or comment (from document.ExtractedLicense) are strings (but they are rdflib.terms.Literal objects when parsed from RDF files), so those functions just return the field (rdflib type).

Again, spdx types should be independent of the format to be written or read.

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