Tuesday, May 31, 2016

Getting started with rdflib.js -- Second experiment

Create a new file in the rdflibexperiments directory:

vim exp2.js

Add the contents:

var $rdf = require('../rdflib.js');

var uri = 'http://bshambaugh.rww.io/profile/card'
var body = '<a> <b> <c> .'
var mimeType = 'text/turtle'
var store = $rdf.graph()

try {
    $rdf.parse(body, store, uri, mimeType)
} catch (err) {
    console.log(err)
}

console.log(store);

Run the contents:

first in vim: wq!

second from the prompt: node exp2.js

To get the results:

var $rdf = require('../rdflib.js');

var uri = 'http://bshambaugh.rww.io/profile/card'
var body = '<a> <b> <c> .'
var mimeType = 'text/turtle'
var store = $rdf.graph()

try {
    $rdf.parse(body, store, uri, mimeType)
} catch (err) {
    console.log(err)
}

console.log(store);



No comments:

Post a Comment