Re: SPDX RDF visualization


Yev Bronshteyn
 

A slight correction to the above – the sparql query in my previous email may be too simplistic in that it does not include files that are inside of packages (as package contents are not necessarily described with relationships).

 

This should produce the graph of both relationships and file contents:

 

prefix spdx: <http://spdx.org/rdf/terms#>

 

construct { ?sub ?pred ?obj .

            ?sub2 spdx:hasFile ?file}

where {

     ?sub spdx:relationship ?rel .

     ?rel spdx:relationshipType ?pred .

     ?rel spdx:relatedSpdxElement ?obj .

     ?sub2 spdx:hasFile ?file .

    

}

From: <spdx-bounces@...> on behalf of Yev Bronshteyn <ybronshteyn@...>
Date: Wednesday, September 21, 2016 at 2:48 PM
To: "STAIR, MICHAEL A" <ms1784@...>, "spdx@..." <spdx@...>
Subject: Re: SPDX RDF visualization

 

Hi, Michael,

 

I don’t know much about RDF graphing tools, but here’s a trick to make any tool you already have produce a better graph.

 

You can use this sparql query to reduce an SPDX document to an RDF where every relationship is reduced to a single triple:

 

prefix spdx: <http://spdx.org/rdf/terms#>

 

construct { ?sub ?pred ?obj }

where {

     ?sub spdx:relationship ?rel .

     ?rel spdx:relationshipType ?pred .

     ?rel spdx:relatedSpdxElement ?obj .

}      

 

 

Here’s how you can apply this query with Apache Jena:

 

1.      Load your spdx document into Jena’s triple store:

tdbloader --loc=data mydoc.rdf

 

In the example above, “data” is an empty directory where you have write access (where Jena will build its datastore) and mydoc.rdf is your SPDX document.

               

2.      Apply the query, which in this example is loaded into “relConcat.sparql”. Pipe the results into a file.


tdbquery --loc=data --query=../relConcat.sparql --results=RDF

 

 

The resulting RDF should be a much more straightforward graph of all the relationsips.

 

From: <spdx-bounces@...> on behalf of "STAIR, MICHAEL A" <ms1784@...>
Date: Wednesday, September 21, 2016 at 2:16 PM
To: "spdx@..." <spdx@...>
Subject: SPDX RDF visualization

 

Hello,

 

I was wondering if anyone can suggest a tool to visually in a graph (ideally interactive) SPDX RDF files, specifically to follow relationships? I am currently using gruff (http://franz.com/agraph/gruff/) , but it’s a little tedious. Thanks.

 

Mike

_____________________________
Michael Stair
Principal Member of Technical Staff
AT&T Chief Security Office (CSO)
301.865.3877
mstair@...

Join spdx@lists.spdx.org to automatically receive all group messages.