Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create concrete classes for license individuals #588

Merged
merged 4 commits into from
Jan 31, 2024
Merged

Create concrete classes for license individuals #588

merged 4 commits into from
Jan 31, 2024

Conversation

goneall
Copy link
Member

@goneall goneall commented Dec 23, 2023

Fixes #574

This PR implements concrete classes by the same name as the individuals. The concrete classes inherit from a comment IndividualLicense class.

An alternative solution to #574 is to have the individuals use the IndividualLicense type directly.

The only reason I chose this approach is that having different types may match some language implementations more closely - but I could easily be persuaded to take the alternative solution.

@goneall goneall requested review from zvr and sbarnum December 23, 2023 19:56
@goneall goneall added the Profile:Licensing Licensing Profile and related matters label Dec 23, 2023
@goneall goneall added this to the 3.0-rc2 milestone Dec 23, 2023
@swinslow
Copy link
Member

swinslow commented Jan 9, 2024

@goneall Thank you for this! Taking a look now and I will circle back.

Copy link
Member

@swinslow swinslow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@goneall Thanks again for this!

I don't have a particular preference for whether to take the approach you described here, or the alternate approach you mentioned of having the individuals NoneLicense / NoAssertionLicense use IndividualLicense directly.

I'll defer to others if there are strong feelings on that point, but since there haven't been any comments here for the past couple of weeks, I'm inclined to go with what you proposed here.

Assuming we take this approach, I have a few comments -- please see below and let me know what you think!


## Summary

A concrete subclass of AnyLicenseInfo used by Individuals in the ExpandedLicensing profile.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my overall comment about whether to use the approach described here or the alternative you mentioned in the discussion thread. Assuming we use the one you did here, though, then is it accurate that IndividualLicense is a "concrete" subclass? Or is it an abstract subclass, since only the NoneLicense and NoAssertionLicense classes should actually be instantiated?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @swinslow - really good catches.

After reviewing the comments, I no longer see a need for the IndividualLicense class, I can just subclass AnyLicenseInfo directly for None and NoAssertion license types.

I'll update the PR accordingly.


- name: IndividualLicense
- SubclassOf: /SimpleLicensing/AnyLicenseInfo
- Instantiability: Concrete
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question / comment as above


## Summary

A License when no assertion can be made about its actual value.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To align with the NoneLicense class text below, should this say something like:

"A concrete subclass of IndividualLicense used by the NoAssertionLicense Individual in the ExpandedLicensing profile."

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll align with the text below.


## Summary

A concrete subclass of AnyLicenseInfo used by Individuals in the ExpandedLicensing profile.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this reference IndividualLicense instead of AnyLicenseInfo? And also specify which Individual uses it? E.g.:

"A concrete subclass of IndividualLicense used by the NoneLicense Individual in the ExpandedLicensing profile."

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll solve this by getting rid of IndividualLicense

Per review comments, I'm removing the IndividualLicense to resolve
inconsistencies in the previous commit.
Copy link
Member

@zvr zvr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't agree with creating two new classes, with the exact same name as the individuals(!). People will confuse them, they might use the class instead of the individual, etc. It will become messy very quickly,..

And having these classes does not really help. They are concrete, so... can I use them to create more instances/individuals? I shouldn't be able to do so.

I think this approach creates more problems than it solves.
What is the problem we're trying to solve?

@goneall
Copy link
Member Author

goneall commented Jan 11, 2024

@zvr - Issue #574 - If you can come up with a better solution, please create a different PR and I'll close this one.

@sbarnum
Copy link
Collaborator

sbarnum commented Jan 17, 2024

I agree with @zvr that this approach seems overly complicated and unlikely to lead to the targeted goal.

It seems to me that the simple solution to the issue identified in #574 is simply to make NoAssertionLicense and NoneLicense to be individuals of the LicenseExpression class which is an already existing concrete subclass of AnyLicenseInfo. You could simply have licenseExpression="NONE" or "NOASSERTION" respectively for each Individual.

In the definition of the licenseExpression property on the LicenseExpression class it states "A license expression could be a single license identifier found on the SPDX License List; a user defined license reference denoted by the LicenseRef-idString; a license identifier combined with an SPDX exception; or some combination of license identifiers, license references and exceptions constructed using a small set of defined operators (e.g., AND, OR, WITH and +)."
This should cover the NoAssertionLicense and NoneLicense shouldn't it?

NOTE: Individuals are simply instance objects. They are asserted to be members of one or more classes and they MUST have an globally unique ID (in our case an spdxId). This means that in the SPDX spec where we specify Individuals we need to be explicit that the "name" specified for the Individual is actually its spdxId and those names need to explicitly include the base SPDX id prefix for SPDX defined Individuals (i.e., something more like "https://ontology.spdx.org/3.0/licenses/individuals/NoAssertionLicense" rather than just "NoAssertionLicense").
It seems like it would make sense to keep the "name" field in the markdown spec for an Individual and simply add a new "Id" field with the full Id that the then the value of the "Id" field could be used to generate the id of the formal rdf/owl Individual.

In a nutshell, the only changes required in a PR would be:

  1. In model/ExpandedLicensing/Individuals/NoAssertionLicense.md
    1.1 modify from "type: /SimpleLicensing/AnyLicenseInfo" to "type: /SimpleLicensing/LicenseExpression"
    1.2 add "id: "NoAssertionLicense""
    1.3 under "Property Values" modify from "name: "NOASSERTION"" to "licenseExpression: "NOASSERTION""
  2. In model/ExpandedLicensing/Individuals/NoneLicense.md
    2.1 modify from "type: /SimpleLicensing/AnyLicenseInfo" to "type: /SimpleLicensing/LicenseExpression"
    2.2 add "id: "NoneLicense""
    2.3 under "Property Values" modify from "name: "NONE"" to "licenseExpression: "NONE""

@@ -1,21 +0,0 @@
SPDX-License-Identifier: Community-Spec-1.0

# IndividualLicense
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IndividualLicenseInfo instead of IndividualLicense

Restore this class

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IndividualLicensingInfo... since it's not info on a license

@goneall
Copy link
Member Author

goneall commented Jan 23, 2024

Based on tech call on 23 Jan 2023:

Updates the individuals for license per review comments

Signed-off-by: Gary O'Neall <[email protected]>
@goneall
Copy link
Member Author

goneall commented Jan 24, 2024

@zvr @sbarnum I just updated the PR with the changes we discussed.

I used the names "NONE" and "NOASSERTION" to be compatible with the previous names used in SPDX 2.X.

For the ID's, I didn't include anything in the markdown file. I figure we would generate the correct ID based on the individual name and profile rather than specify it in the file.

@goneall goneall requested a review from zvr January 24, 2024 22:07
Copy link
Member

@maxhbr maxhbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I am late to this PR and from reading the diff I can not understand why there are files .../Classes/NoAssertionLicense.md and .../Individuals/NoAssertionLicense.md, but seemingly no connection between them.

Please ignore my question, if that is clear for everyone else.

@@ -15,7 +15,7 @@ the SPDX creator has intentionally provided no information (no meaning should be
## Metadata

- name: NoAssertionLicense
- type: /SimpleLicensing/AnyLicenseInfo
- type: IndividualLicensingInfo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is model/ExpandedLicensing/Individuals/NoAssertionLicense.md not of type model/ExpandedLicensing/Classes/NoAssertionLicense.md? I am confused to see it in Individuals and Classes an the same time

## Metadata

- name: NoAssertionLicense
- SubclassOf: /SimpleLicensing/AnyLicenseInfo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is model/ExpandedLicensing/Classes/NoAssertionLicense.md not a subclass of model/ExpandedLicensing/Classes/IndividualLicensingInfo.md, which is "A concrete subclass of AnyLicenseInfo used by Individuals in the ExpandedLicensing profile."

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be deleted.

@zvr
Copy link
Member

zvr commented Jan 25, 2024

You are correct, @maxhbr . @goneall simply forgot to delete the two classes (None and NoAssertion).

The idea is to have only the new class IndividualLicensingInfo (concrete, from SimpleLicensing/AnyLicenseInfo) and the two individuals as instances of that class.

Copy link
Member

@zvr zvr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the two class files are deleted, this is good to go.

## Metadata

- name: NoAssertionLicense
- SubclassOf: /SimpleLicensing/AnyLicenseInfo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be deleted.


- name: NoneLicense
- SubclassOf: /SimpleLicensing/AnyLicenseInfo
- Instantiability: Concrete
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be deleted.

@goneall
Copy link
Member Author

goneall commented Jan 25, 2024

If the two class files are deleted, this is good to go.

Good catch @zvr - The two files are now deleted

@goneall goneall mentioned this pull request Jan 30, 2024
32 tasks
@sbarnum
Copy link
Collaborator

sbarnum commented Jan 30, 2024

@zvr @sbarnum I just updated the PR with the changes we discussed.

I used the names "NONE" and "NOASSERTION" to be compatible with the previous names used in SPDX 2.X.

For the ID's, I didn't include anything in the markdown file. I figure we would generate the correct ID based on the individual name and profile rather than specify it in the file.

There are only two properties that ANY Individual in ANY ontology MUST define: ID and TYPE.
They MAY define other properties but only have to based on property cardinality restrictions on the TYPE Class.

I strongly believe that the markdown version of the spec needs to include the IDs for ANY Individuals including these two.
When dealing with an Individual the ID is the actual identifier/name for that object.
The 'name' property is only a label.

The intent of the markdown version of the spec is for human readability and clarity.
Anyone who wants to reference either of these Individuals in actual SPDX 3.X content MUST use the ID not the 'name'.
Any code written to deal with the concepts of NONE and NOASSERTION MUST use the ID not the 'name'.

I believe including a 'name' but not the one and only one ID to use for each Individual is very highly likely to lead to confusion and invalid content.

Copy link
Collaborator

@sbarnum sbarnum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that the IDs for each Individual needs to be included in their respective markdown definition files.
Explanation is in a comment in the Conversation for this PR.

Everything else looks great.

@goneall
Copy link
Member Author

goneall commented Jan 30, 2024

I believe that the IDs for each Individual needs to be included in their respective markdown definition files. Explanation is in a comment in the Conversation for this PR.

Everything else looks great.

I don't feel strongly, but I believe the ID's can be assigned by convention in the same way we assign ID's to the class and properties without explicitly stating them in the markdown.

Probably worth a 10 minute discussion with @sbarnum @zvr myself and anyone else interested in the RDF IDs.

One issue for RC2 is that adding an ID field may break the spec-parser. I'll create a separate issue to track fixing this either before RC2 if there is time, or after RC2 and before final release.

@zvr
Copy link
Member

zvr commented Jan 30, 2024

@sbarnum yes, the individuals must have an id (and they will, in the generated docs and RDF ontology).

@goneall yes, if you put it right now it will break the spec-parser. I will make and push the change on Tue 13 Feb at the latest.

I propose we merge this one and we know we have to add the IRIs at a later stage. If you both remember, I had proposed to use https://rdf.spdx.org/v3/Licensing/None and .../NoAssertion (or something like that, I will check my notes once I'm back).

@goneall
Copy link
Member Author

goneall commented Jan 31, 2024

I'll go ahead and merge - we have another issue to track the creation of the IDs.

@goneall goneall merged commit 3f7f4e8 into main Jan 31, 2024
0 of 2 checks passed
@goneall goneall deleted the issue574 branch January 31, 2024 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Profile:Licensing Licensing Profile and related matters
Projects
None yet
5 participants