Advertisement
Guest User

Untitled

a guest
Sep 24th, 2021
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const { PathFactory } = require('ldflex');
  2. const { default: ComunicaEngine } = require('@ldflex/comunica');
  3. const { namedNode } = require('@rdfjs/data-model');
  4.  
  5. // The JSON-LD context for resolving properties
  6. const context = {
  7.   "@context": {
  8.     "@base" : "https://raw.githubusercontent.com/polifonia-project/sonar2021_demo/develop/src/assets/data/data.v2.json",
  9.     "@vocab": "https://w3id.org/polifonia/ON/musical-performance/",
  10.     "label": "http://www.w3.org/2000/01/rdf-schema#label"
  11.   },
  12.  
  13. };
  14.  
  15.  
  16. // remote source
  17. const source = 'https://raw.githubusercontent.com/polifonia-project/sonar2021_demo/develop/src/assets/data/data.v2.json'
  18.  
  19.  
  20. // The query engine and its source
  21. const queryEngine = new ComunicaEngine(source);
  22. // The object that can create new paths
  23. const path = new PathFactory({ context, queryEngine });
  24.  
  25.  
  26. // an example resource in the document
  27. const recording1 = path.create({ subject: namedNode('https://w3id.org/polifonia/resource/Recording/00001') })
  28.  
  29.  
  30. showRecording(recording1)
  31.  
  32.  
  33. async function showRecording(rec) {
  34.     console.log(`Resource is: ${await rec.label}`)
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement