rdf2hk
This library contains classes and functions to convert RDF model to the Hyperknowledge model
Install
npm install rdf2hk
Usage
const RDF2HK = require("rdf2hk");
RDF to Hyperknowledge
Example:
const GraphFactory = RDF2HK.GraphFactory;
const mimeType = "application/turtle"
GraphFactory.parseGraph(inputData, mimeType, (err, graph) =>
{
if(err)
{
console.error(err);
return;
}
let hkentities = RDF2HK.Parser.parseGraph(graph);
console.log(hkentities);
});
Hyperknowledge to RDF
Example:
const GraphFactory = RDF2HK.GraphFactory;
const mimeType = "application/turtle"
let graph = GraphFactory.createGraph(mimeType);
Serializer.serialize(hkentities, {}, graph);
GraphFactory.serializeGraph(graph, (err, data) =>
{
if(!err)
{
console.log(data);
}
else
{
console.error(err);
}
});