Skip to content

Functionalities to promote conversions between RDF and Hyperknowledge

License

Notifications You must be signed in to change notification settings

ibm-hyperknowledge/rdf2hk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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" // application/json | application/n-triples | application/n-quads | application/trig | application/turtle | application/rdf+xml
GraphFactory.parseGraph(inputData, mimeType, (err, graph) =>
{
	if(err)
	{
		console.error(err);
		return;
	}

	let hkentities = RDF2HK.Parser.parseGraph(graph);

	console.log(hkentities); // print the converted entities

	// <...>
}); 

Hyperknowledge to RDF

Example:

const GraphFactory = RDF2HK.GraphFactory;

const mimeType = "application/turtle" // application/json | application/n-triples | application/n-quads | application/trig | application/turtle | application/rdf+xml

let graph = GraphFactory.createGraph(mimeType);
    
Serializer.serialize(hkentities, {}, graph); // options: see api reference

GraphFactory.serializeGraph(graph, (err, data) =>
{
	if(!err)
	{
		// Print the rdf serialized data
		console.log(data);

		// <...>
	}
	else
	{
		console.error(err);
	}

});

About

Functionalities to promote conversions between RDF and Hyperknowledge

Resources

License

Stars

Watchers

Forks

Packages

No packages published