Tuesday, May 31, 2016

Getting started with rdflib.js -- my first experiment

I cloned the github repository with:

git clone https://github.com/linkeddata/rdflib.js.git

then I followed the following steps:

cd rdflib.js

sudo su

npm install

make all

npm install -g jquery

npm install -g xmlhttprequest

I was inspired by the instructions at:

https://github.com/linkeddata/rdflib.js/

In separate directory at the same level of hierarchy on the directory tree I created a directory with the name "rdflibexperiments":

cd ..

mkdir rdflibexperiments

cd rdflibexperiments

Then I created a file called "exp1.js":

vim exp1.js

With the contents:

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

var FOAF = $rdf.Namespace("http://xmlns.com/foaf/0.1/");

var foafKnows = FOAF('knows');

console.log(foafKnows);
 

Running this with the command

node exp1.js

gave

NamedNode { uri: 'http://xmlns.com/foaf/0.1/knows' }


The contents of the file was inspired by: 

https://github.com/solid/solid-tutorial-rdflib.js

with a friendly reminder from:

https://github.com/okcoders/ok-coders-summer-2014/blob/master/10-node/10-examples/calculator.js


No comments:

Post a Comment