#
Using the W3C StackThis tutorial shows you how to use the W3C stack of technologies for Linked Data to work with metadata defined using AML.
#
Before you beginPrerequisites:
- JVM: version 7 or higher
- SBT to build the AMF command-line
- Local installation of Apache Jena
#
Download the exampleYou can download the example from the AML project examples repository in Github.
#
Build and install the AMF command-line toolThis tutorial assumes you have a working version of the AMF command-line as described in the quickstart tutorial.
#
Install Apache JenaApache Jena is a popular Java library to work with semantic and linked data. It can be used as a programming library, but also contains a number of command-line tools that we will use in this tutorial.
Installing Jena is beyond the scope of this tutorial. For information about installation for your platform, see the Jena site. For example, in Mac OS systems, Jena can be installed using Homebrew
#
Running a query over the graph of metadataAML documents can be parsed into a graph of metadata using AMF.
This graph is encoded as a JSON-LD document. In this tutorial, we will use Jena to execute a query over this graph of information.
We will generate the resolved graph of information parsing one of the playlist documents in the music example using AMF:
The Jena query command line, needs to get the input data as a set of assertions in the Turtle format. We will use the Jena riot
command line to transform our JSON-LD output file into Turtle and store it in the playlist.ttl
file:
Now, we can run a query over the graph after loading it into Jena. The query is going to be expressed in the standard SPARQL graph query language.
We will list 10 songs ordered by song duration and also retrieve the name of the song:
#
Making the graph growThe graph parsed from AML metadata documents can be enlarged by just adding assertions parsed from the graph.
Let's add another playlist to our graph of metadata, parsing the aml/music/playlist2.yaml
file:
Now, we will use Jena to transform the JSON-LD document into additional assertions to our playlist.ttl graph:
If we run the same query, we will find additional songs:
We can use use the relationship between playlists and songs in the graph to introduce that information into the query: