THE SPDX WIKI IS NO LONGER ACTIVE. ALL CONTENT HAS BEEN MOVED TO https://github.com/spdx

Difference between revisions of "Technical Team/Proposals/2010-12-07/Tag-value RDF mapping"

From SPDX Wiki
Jump to: navigation, search
Line 24: Line 24:
 
<p>A uniform way declare new resources (entities) and link to them
 
<p>A uniform way declare new resources (entities) and link to them
 
will be introduced.  A new resource would be declared by enclosing the
 
will be introduced.  A new resource would be declared by enclosing the
type of the resource and it's uri, or node-id if it is a blank node,
+
type of the resource and it's uri, either full or a <a href="http://www.w3.org/TR/2007/WD-curie-20070307/">CURIE</a> or
in square brackets ("[", "]").  The resource type would either be a
+
node-id if it is a blank node, in square brackets ("[", "]").  The
full uri and enclosed in angle brackets or a spdx class name without
+
resource type will be Package, File, Project or License</p>
the spdx vocabulary prefix.</p>
+
 
+
<p>A uniform way to reference bank nodes would be introduced.  A node
+
id reference would be a string that starts with a "@".  This would
+
allow any tag to reference a blank node resource declared in the spdx
+
files.  Node ids would be scoped to the spdx file in which they occur.</p>
+
  
 
<p>A uniform way to handle multiline values will be introduced.  Any
 
<p>A uniform way to handle multiline values will be introduced.  Any
Line 41: Line 35:
 
multiline values on unrecognized fields which dramatically improves
 
multiline values on unrecognized fields which dramatically improves
 
forward compatibility.</p>
 
forward compatibility.</p>
 +
 +
<p>Values would will be treated as literals unless the SPDX processor
 +
is aware that the tag is declared as an owl:ObjectProperty.  For
 +
owl:ObjectProperty fields the SPDX processor can resolve the value
 +
into a resource by first looking at the blank node ids in the
 +
document, if the value does not match any of the declared node ids it
 +
should be treated as a <a href="http://www.w3.org/TR/2007/WD-curie-20070307/">CURIE</a> or URI.
 +
For the purpose of CURIE resolution the following prefixes will be
 +
defined: license (the SPDX license repo prefix), doap</p>
  
 
<h3>Example 1: Simple SPDX file with non-standard license</h3>
 
<h3>Example 1: Simple SPDX file with non-standard license</h3>
  
<pre><code><br />SPDXVersion: SPDX-1.0<br />CreatedBy: Tool: spdx-gen 1.0<br /><br />[Package &lt;http://oss.net/foo-1.0.tar.gz&gt;]<br />DeclaredLicense: @FullLicense-1<br />DeclaredLicense: &lt;license:GPL2&gt;<br />Description: "This<br />is along<br />multiline value"<br /><br />[License FullLicnse-1]<br />LicenseText: "<br />Some terms and conditions<br />"<br /><br /></code></pre>
+
<pre><code>
 +
SPDXVersion: SPDX-1.0
 +
CreatedBy: Tool: spdx-gen 1.0
 +
 
 +
[Package http://oss.net/foo-1.0.tar.gz]
 +
DeclaredLicense: FullLicense-1
 +
DeclaredLicense: license:GPL2
 +
Description: "This
 +
is along
 +
multiline value"
 +
 
 +
[License FullLicnse-1]
 +
LicenseText: "
 +
Some terms and conditions
 +
"
 +
 
 +
</code></pre>
  
 
<h3>Example 2: Simple SPDX file with vendor specific tag</h3>
 
<h3>Example 2: Simple SPDX file with vendor specific tag</h3>
  
<pre><code><br />SPDXVersion: SPDX-1.0<br />CreatedBy: Tool: spdx-gen 1.0<br /><br />[Package &lt;http://oss.net/foo-1.0.tar.gz&gt;]<br />DeclaredLicense: &lt;license:GPL2&gt;<br />Description: "This<br />is along<br />multiline value"<br />&lt;http://example.org/sha256-signature&gt;: "ac44f9eecaf832..."<br /></code></pre>
+
<pre><code>
 +
SPDXVersion: SPDX-1.0
 +
CreatedBy: Tool: spdx-gen 1.0
 +
 
 +
[Package http://oss.net/foo-1.0.tar.gz]
 +
DeclaredLicense: license:GPL2
 +
Description: "This
 +
is a long
 +
multiline value"
 +
&lt;http://example.org/sha256-signature&gt;: "ac44f9eecaf832..."
 +
</code></pre>
  
 
<h3>Example 3: Simple SPDX file with files</h3>
 
<h3>Example 3: Simple SPDX file with files</h3>
  
<pre><code><br />SPDXVersion: SPDX-1.0<br />CreatedBy: Tool: spdx-gen 1.0<br /><br />[Package &lt;http://oss.net/foo-1.0.tar.gz&gt;]<br />DeclaredLicense: &lt;license:GPL2&gt;<br />Description: "This<br />is along<br />multiline value"<br />Files: &lt;http://oss.net/foo-1.0.tar.gz#foo.c&gt;, &lt;http://oss.net/foo-1.0.tar.gz#bar.c&gt;<br /><br />[File &lt;http://oss.net/foo-1.0.tar.gz#foo.c&gt;]<br />Type: source<br />DetectedLicense: &lt;license:GPL2&gt;<br /><br />[File &lt;http://oss.net/foo-1.0.tar.gz#bar.c&gt;]<br />Type: source<br />DetectedLicense: &lt;license:GPL2&gt;<br /><br /></code></pre>
+
<pre><code>
 +
SPDXVersion: SPDX-1.0
 +
CreatedBy: Tool: spdx-gen 1.0
 +
 
 +
[Package http://oss.net/foo-1.0.tar.gz]
 +
DeclaredLicense: license:GPL2
 +
Description: "This
 +
is along
 +
multiline value"
 +
Files, http://oss.net/foo-1.0.tar.gz#foo.c, http://oss.net/foo-1.0.tar.gz#bar.c
 +
 
 +
[File http://oss.net/foo-1.0.tar.gz#foo.c]
 +
Type: source
 +
DetectedLicense: license:GPL2
 +
 
 +
[File http://oss.net/foo-1.0.tar.gz#bar.c]
 +
Type: source
 +
DetectedLicense: license:GPL2
 +
</code></pre>
  
 
<h3>Example 4: Simple SPDX file with file and artifact info</h3>
 
<h3>Example 4: Simple SPDX file with file and artifact info</h3>
  
<pre><code><br />SPDXVersion: SPDX-1.0<br />CreatedBy: Tool: spdx-gen 1.0<br /><br />[Package &lt;http://oss.net/foo-1.0.tar.gz&gt;]<br />DeclaredLicense: &lt;license:GPL2&gt;<br />Description: "This<br />is along<br />multiline value"<br />Files: &lt;http://oss.net/foo-1.0.tar.gz#foo.c&gt;<br /><br />[File &lt;http://oss.net/foo-1.0.tar.gz#foo.c&gt;]<br />Type: source<br />DetectedLicense: &lt;license:GPL2&gt;<br />ArtifactOf: @JRandomProject<br /><br />[&lt;doap:Project&gt; JRandomProject]<br />&lt;doap:name&gt;: J Random Project<br />&lt;doap:homepage&gt;: http://oss.org/j-random-project<br /><br /></code></pre>
+
<pre><code>
 +
SPDXVersion: SPDX-1.0
 +
CreatedBy: Tool: spdx-gen 1.0
 +
 
 +
[Package http://oss.net/foo-1.0.tar.gz]
 +
DeclaredLicense: license:GPL2
 +
Description: "This
 +
is along
 +
multiline value"
 +
Files: http://oss.net/foo-1.0.tar.gz#foo.c
 +
 
 +
[File http://oss.net/foo-1.0.tar.gz#foo.c]
 +
Type: source
 +
DetectedLicense: license:GPL2
 +
ArtifactOf: JRandomProject
 +
 
 +
[doap:Project JRandomProject]
 +
doap:name: J Random Project
 +
doap:homepage: http://oss.org/j-random-project
 +
 
 +
</code></pre>

Revision as of 03:20, 13 December 2010

Status

Draft


Issue

The mechanism and details of how the tag-value format relates to the rdf model are not clear. Also there are many special cases regarding now following lines are parsed based on the tag. These issues combined with the lack of an overview section on the tag-value format make it hard to understand how the tag-value files should be produced.

Proposal

The direct relationship between the tags and rdf properties will be stated explicitly. All simple tag names match rdf property name without the spdx vocabulary prefix. Arbitrary rdf properties will be allows to be tags when they are enclosed in angle brackets ("<", ">"). This will support forward compatibility and innovation by allowing vendor or communities to introduce new data into spdx files.

A uniform way declare new resources (entities) and link to them will be introduced. A new resource would be declared by enclosing the type of the resource and it's uri, either full or a <a href="http://www.w3.org/TR/2007/WD-curie-20070307/">CURIE</a> or node-id if it is a blank node, in square brackets ("[", "]"). The resource type will be Package, File, Project or License

A uniform way to handle multiline values will be introduced. Any tag value that started with double quote ('"') would extend until a second, unescaped, double quote was encountered. If the content of the value included a double quote it could be escaped by prefixing it with a back slash character ("\"). This will allow parsers to handle multiline values on unrecognized fields which dramatically improves forward compatibility.

Values would will be treated as literals unless the SPDX processor is aware that the tag is declared as an owl:ObjectProperty. For owl:ObjectProperty fields the SPDX processor can resolve the value into a resource by first looking at the blank node ids in the document, if the value does not match any of the declared node ids it should be treated as a <a href="http://www.w3.org/TR/2007/WD-curie-20070307/">CURIE</a> or URI. For the purpose of CURIE resolution the following prefixes will be defined: license (the SPDX license repo prefix), doap

Example 1: Simple SPDX file with non-standard license

<code>
SPDXVersion: SPDX-1.0
CreatedBy: Tool: spdx-gen 1.0

[Package http://oss.net/foo-1.0.tar.gz]
DeclaredLicense: FullLicense-1
DeclaredLicense: license:GPL2
Description: "This
is along
multiline value"

[License FullLicnse-1]
LicenseText: "
Some terms and conditions
"

</code>

Example 2: Simple SPDX file with vendor specific tag

<code>
SPDXVersion: SPDX-1.0
CreatedBy: Tool: spdx-gen 1.0

[Package http://oss.net/foo-1.0.tar.gz]
DeclaredLicense: license:GPL2
Description: "This
is a long
multiline value"
<http://example.org/sha256-signature>: "ac44f9eecaf832..."
</code>

Example 3: Simple SPDX file with files

<code>
SPDXVersion: SPDX-1.0
CreatedBy: Tool: spdx-gen 1.0

[Package http://oss.net/foo-1.0.tar.gz]
DeclaredLicense: license:GPL2
Description: "This
is along
multiline value"
Files, http://oss.net/foo-1.0.tar.gz#foo.c, http://oss.net/foo-1.0.tar.gz#bar.c

[File http://oss.net/foo-1.0.tar.gz#foo.c]
Type: source
DetectedLicense: license:GPL2

[File http://oss.net/foo-1.0.tar.gz#bar.c]
Type: source
DetectedLicense: license:GPL2
</code>

Example 4: Simple SPDX file with file and artifact info

<code>
SPDXVersion: SPDX-1.0
CreatedBy: Tool: spdx-gen 1.0

[Package http://oss.net/foo-1.0.tar.gz]
DeclaredLicense: license:GPL2
Description: "This
is along
multiline value"
Files: http://oss.net/foo-1.0.tar.gz#foo.c

[File http://oss.net/foo-1.0.tar.gz#foo.c]
Type: source
DetectedLicense: license:GPL2
ArtifactOf: JRandomProject

[doap:Project JRandomProject]
doap:name: J Random Project
doap:homepage: http://oss.org/j-random-project

</code>