Over the past couple of weeks, I’ve been working on expanding the linking services that MarcEdit can work with in order to create identifiers for controlled terms and headings. One of the services that I’ve been experimenting with is NLM’s beta SPARQL endpoint for MESH headings. MESH has always been something that is a bit foreign to me. While I had been a cataloger in my past, my primary area of expertise was with geographic materials (analog and digital), as well as traditional monographic data. While MESH looks like LCSH, it’s quite different as well. So, I’ve been spending some time trying to learn a little more about it, while working on a process to consistently query the endpoint to retrieve the identifier for a preferred Term. Its been a process that’s been enlightening, but also one that has led me to think about how I might create a process that could be used beyond this simple use-case, and potentially provide MarcEdit with an RDF engine that could be utilized down the road to make it easier to query, create, and update graphs.
Since MarcEdit is written in .NET, this meant looking to see what components currently exist that provide the type of RDF functionality that I may be needing down the road. Fortunately, a number of components exist, the one I’m utilizing in MarcEdit is dotnetrdf (https://bitbucket.org/dotnetrdf/dotnetrdf/wiki/browse/). The component provides a robust set of functionality that supports everything I want to do now, and should want to do later.
With a tool kit found, I spent some time integrating it into MarcEdit, which is never a small task. However, the outcome will be a couple of new features to start testing out the toolkit and start providing users with the ability to become more familiar with a key semantic web technology, SPARQL. The first new feature will be the integration of MESH as a known vocabulary that will now be queried and controlled when run through the linked data tool. The second new feature is a SPARQL Browser. The idea here is to give folks a tool to explore SPARQL endpoints and retrieve the data in different formats. The proof of concept supports XML, RDFXML, HTML. CSV, Turtle, NTriple, and JSON as output formats. This means that users can query any SPARQL endpoint and retrieve data back. In the current proof of concept, I haven’t added the ability to save the output – but I likely will prior to releasing the Christmas MarcEdit update.
Proof of Concept
While this is still somewhat conceptual, the current SPARQL Browser looks like the following:
At present, the Browser assumes that data resides at a remote endpoint, but I’ll likely include the ability to load local RDF, JSON, or Turtle data and provide the ability to query that data as a local endpoint. Anyway, right now, the Browser takes a URL to the SPARQL Endpoint, and then the query. The user can then select the format that the result set should be outputted.
Using NLM as an example, say a user wanted to query for the specific term: Congenital Abnormalities – utilizing the current proof of concept, the user would enter the following data:
SPARQL Endpoint: http://id.nlm.nih.gov/mesh/sparql
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX meshv: <http://id.nlm.nih.gov/mesh/vocab#>
PREFIX mesh: <http://id.nlm.nih.gov/mesh/>
SELECT distinct ?d ?dLabel
?d meshv:preferredConcept ?q .
?q rdfs:label 'Congenital Abnormalities' .
?d rdfs:label ?dLabel .
ORDER BY ?dLabel
Running this query within the SPARQL Browser produces a resultset that is formatted internally into a Graph for output purposes.
The images snapshot a couple of the different output formats. For example, the full JSON output is the following:
"value": "Congenital Abnormalities"
The idea behind creating this as a general purpose tool, is that in theory, this should work for any SPARQL endpoint. For example, the Project Gutenberg Metadata endpoint. The same type of exploration can be done, utilizing the Browser.
At this point, the SPARQL Browser represents a proof of concept tool, but one that I will make available as part of the MARCNext research toolset:
As part of the next update. Going forward, I will likely refine the Browser based on feedback, but more importantly, start looking at how the new RDF toolkit might allow for the development of dynamic form generation for editing RDF/BibFrame data…at least somewhere down the road.
 SPARQL (W3C): http://www.w3.org/TR/rdf-sparql-query/
 SPARQL (Wikipedia): http://en.wikipedia.org/wiki/SPARQL
 SPARQL Endpoints: http://www.w3.org/wiki/SparqlEndpoints
 MarcEdit: http://marcedit.reeset.net
 MARCNext: http://blog.reeset.net/archives/1359