Intent: I am trying to display and navigate RDF data in Typescript. I have Turtle files containing RDF entities, and TS classes that model these entities. I use the TS classes to populate Vue.js templates and render these entities dynamically.
To some extent, I’m trying to replicate JSON-LD parsing into an object with TTL.
Given the following file (skipping prefixes),
<#example-en> a lime:Lexicon ; rdfs:label "Example wordnet (English)"@en ; dc:language "en" ; schema:email "email@example.com" ; cc:license <https://creativecommons.org/publicdomain/zero/1.0/> ; owl:versionInfo "1.0" ; schema:citation "CILI: the Collaborative Interlingual Index. Francis Bond, Piek Vossen, John P. McCrae and Christiane Fellbaum, Proceedings of the Global WordNet Conference 2016, (2016)." ; schema:url "http://globalwordnet.github.io/schemas/" ; dc:publisher "Global Wordnet Association" ; lime:entry <#w1>, <#w2>, <#w3> .
is it possible to parse the TTL file, then access field values in the following manner:
const data = load(ttl); // magic function parsing TTL string const publisher = data['publisher']; // "Global Wordnet Association" const name = data['label']['en']; // "Example wordnet (English)"
Stack: I am currently using Vue.js, Typescript and N3.js.
Using N3.Parser, I can read TTL files into arrays of Quads, which I am then unable to convert to JS objects in a “straightforward” way.
I am constrained by the fact this needs to be done on the client side (browser).
Any piece of advice or suggested reading will be appreciated
NB: I am relatively new to Typescript and RDF, so I’m not really sure that this is the right way to go.