I have programmed a simple RDF viewer called RDFV RDF Viewer for viewing RDF. Copy and paste the contents of an RDF turtle or n-triples file into the box. The viewer will let you click on an element to highlight it and other instances of the same value, as well as triples with the same subject.
Why? The viewer has two purposes:
1) to make the analysis of RDF files easier. Although turtle/n-triples (I shall refer only to turtle) files are the easiest RDF files to read (certainly compated to RDF/XML which is impenetrable), they can still be complex, especially when there are lots of blank nodes. In particular, I have been trying to get to grips with BIBFRAME data, which can have things like this:
<http://id.loc.gov/resources/bibs/10342843>
bf:creator _:bnode2049831104 ;
bf:subject _:bnode1676317824 ,
_:bnode942225664 ;
The bnodes to which these refer can be many lines away and it is not trivial to match them up. I tried printing data out and drawing lines between them, but this got lost in secret symbols and incoherent scribbles. I thought there must be a better way. With the viewer, you can click on, for example, “_:bnode1676317824” and it will highlight it in bold and in red text, and do the same for all other occurences of “_:bnode1676317824”. At the top, the number of instances will be shown.
2) To make demonstrating and training easier. I am trying to keep colleagues up to speed with linked data and BIBFRAME and it is especially useful I think to show people real linked data as much as possible. RDF is a trifle intimidating to say the least as first glance, so it is helpful to isolate and highlight sections if possible. As well as highlighting bnodes so you can show how one bit relates to another, the viewer also highlights all the triples with the same subject. So, in the above example, all the triples with the subject “<http://id.loc.gov/resources/bibs/10342843>” will be displayed with a shaded background colour when you click on it.
3. As a way of engaging with RDF, linked data, and BIBFRAME in particular, as well as programming in general. This is my first defence against the person who points out that Tool X already exists to do this and is in fact much better.
How to use it. Simply copy and paste the contents of an RDF turtle file into the box and click Submit. The triples will then be displayed underneath. Click on the data itself to highlight various bits. There are two sets of sample data included, both for the same book (Models for decision by C.M. Berners-Lee):
- OCLC sample data from the linked data example given and explained in my post about One record in lots of metadata formats.
- BIBFRAME data produced from the BIBFRAME website and run through a converter to turn it into turtle.
I hope to add some more examples. To look at your own BIBFRAME examples, following the steps below:
- Go to http://bibframe.org/tools/compare/
- Enter an LC system ID into the box (e.g. 10342843) and click on Search.
- Click on BIBFRAME RDF/XML.
- Select and copy everything in the box.
- Go to http://www.rdfabout.com/demo/validator/ and make sure Input Format is set to RDF/XML
- Paste the BIBFRAME data into the box, overwriting anything that’s already there.
- Click on Validate. You will get three versions of the RDF: as Notation 3 (of which Turtle is a subset); N-Triples; and RDF/XML.
- Select and copy either all of the Notation 3 or the N-Triples. Notation 3 is by far the easiest to read.
- Go to http://www.aurochs.org/rdfv/rdfv.html
- Paste the RDF data into the box.
- Click on Submit.
Technical stuff. The code accepts anything which is in turtle or turtle-like in nature. However, there are probably some strange characters it won’t like and some data structures that will fool it. In particular, it tries to shoehorn everything into three main columns: subject, predicate, object; there are also punctuation and language but the point is that nested triples won’t necessarily look particularly impressive. Moreover, it is only a viewer and it does not understand RDF: it can’t make inferences based on the data and won’t even know, given the prefix statement
@prefix bf: <http://bibframe.org/vocab/> .
that
bf:subject
and
http://bibframe.org/vocab/subject
are the same thing.
RDFV will not rewrite or abbreviate the data, with two exceptions: it formats its own white space and, if the punctuation at the end of a line immediately follows some data, it inserts a space before it, more for its own parsing ability as anything else. Please do let me know if you see anything wrong with it.
The viewer is written entirely in Javascript.
Improvements. I am planning and/or hoping to do some further improvements, including some greater control over the formatting from the page itself, some more examples (especially as BIBFRAME evolves).