Yash-Varshney / tools-python

A Python library to parse, validate and create SPDX documents.
http://spdx.org
Apache License 2.0
0 stars 0 forks source link

parse_rdf.py is not showing relationships #1

Closed Yash-Varshney closed 4 years ago

Yash-Varshney commented 4 years ago

when running the parse_rdf.py with data/SPDXRdfExample.rdf ( I have added one relationship from java tool ) it does not show relationship and gives this error:

Relationships: 
Traceback (most recent call last):
  File "parse_rdf.py", line 91, in <module>
    for relation in doc.relationships:
AttributeError: 'Document' object has no attribute 'relationships'

moreover when printing (doc.dict) to get all elements inside doc, it doesn't have relationship.

rdf format of relationship which I added in SPDXRdfExample.rdf

    <relationship>
      <Relationship>
        <relationshipType rdf:resource="http://spdx.org/rdf/terms#relationshipType_describes"/>
        <relatedSpdxElement rdf:resource="http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#SPDXRef-Package"/>
      </Relationship>
    </relationship>
Yash-Varshney commented 4 years ago

Issue solved. Closing.