Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { PathFactory } = require('ldflex');
- const { default: ComunicaEngine } = require('@ldflex/comunica');
- const { namedNode } = require('@rdfjs/data-model');
- // The JSON-LD context for resolving properties
- const context = {
- "@context": {
- "@base" : "https://raw.githubusercontent.com/polifonia-project/sonar2021_demo/develop/src/assets/data/data.v2.json",
- "@vocab": "https://w3id.org/polifonia/ON/musical-performance/",
- "label": "http://www.w3.org/2000/01/rdf-schema#label"
- },
- };
- // remote source
- const source = 'https://raw.githubusercontent.com/polifonia-project/sonar2021_demo/develop/src/assets/data/data.v2.json'
- // The query engine and its source
- const queryEngine = new ComunicaEngine(source);
- // The object that can create new paths
- const path = new PathFactory({ context, queryEngine });
- // an example resource in the document
- const recording1 = path.create({ subject: namedNode('https://w3id.org/polifonia/resource/Recording/00001') })
- showRecording(recording1)
- async function showRecording(rec) {
- console.log(`Resource is: ${await rec.label}`)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement