spdx / spdx-java-tagvalue-store

SPDX Document Storage using the Tag/Value format
Apache License 2.0
2 stars 1 forks source link

Deserializing document does not populate documentNamespace in model store #26

Closed nicoweidner closed 1 year ago

nicoweidner commented 1 year ago

I used the following minimal example for testing:

SPDXVersion: SPDX-2.2
DataLicense: CC0-1.0
DocumentNamespace: some_namespace
DocumentName: SPDX-tool-test
SPDXID: SPDXRef-DOCUMENT

## Creation Information
Creator: Tool: test-tool
Created: 2022-01-01T00:00:00Z
## Relationships
Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-somefile

FileName: ./foo.txt
SPDXID: SPDXRef-somefile
FileChecksum: SHA1: d6a770ba38583ed4bb4525bd96e50461655d2758
LicenseConcluded: LGPL-3.0-only
FileCopyrightText: <text>Copyright 2022 some guy</text>

I deserialized via:

var document = SpdxToolsHelper.deserializeDocument(file);

(where the tools helper is from tools-java, but it boils down to the tagvalue store from this repo).

While document.getDocumentUri() correctly returns the namespace, no value is present in the model store for documentNamespace, as can be checked via

document.getModelStore().getPropertyValueNames("some_namespace", "SPDXRef-DOCUMENT")

or

document.getModelStore().getValue("some_namespace", "SPDXRef-DOCUMENT", "documentNamespace")

Note: The problem seems specific to this store, at least the xml store does not have the same issue. I didn't try the other stores yet

nicoweidner commented 1 year ago

@goneall This can be closed.

The issue came up while testing a new comparison tool (one version had the documentNamespace property, while the other didn't). However, the issue was rather that the jackson store should not save documentNamespace as a property (it's contained in the key anyway). So the tag/value store actually behaves correctly by not persisting documentNamespace.

See the linked issue for the corresponding discussion.

goneall commented 1 year ago

@nicoweidner Makes sense - closing this issue.