cytoscape-rdf
v0.0.11
Published
A Web Component to display RDF quads data as cytoscape network
Downloads
4
Readme
🧬 A web component to visualize RDF with Cytoscape
A web component to easily display RDF quads data as a Cytoscape JS network.
This component has been built specifically to visualize Nanopublications, but can be used with any RDF quads data (composed of subject, predicate, object, graph).
⚠️ Currently the component only supports RDF in the
trig
format
Getting started
To install in a project:
npm install --save cytoscape-rdf
# or
yarn add cytoscape-rdf
# or import in a html file
<script type="module" src="https://cdn.jsdelivr.net/npm/@vemonet/cytoscape-rdf/dist/cytoscape-rdf.min.js"></script>
Use in your HTML, or any other framework, to visualize RDF:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Cytoscape RDF</title>
<meta charset="UTF-8" />
<script type="module" src="/src/cytoscape-rdf.ts"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@vemonet/cytoscape-rdf/dist/cytoscape-rdf.min.js"></script>
</head>
<body>
<div style="height: 100vh; width: 70%;">
<cytoscape-rdf
url="https://purl.org/np/RAHtkscyyyJDLvWRuINckQrn5rbHzQKvwakNVC3fmRzGU.trig"
id="cytoscapeNanopub"
/>
</div>
</body>
</html>
Attributes available on <cytoscape-rdf>
:
url
: to pass a URL to retrieve the RDF to displayrdf
: to pass the RDF directly as a string in thetrig
formatelements
: to pass directly the cytoscape elementscytoscapeStyle
: to pass the style object for cytoscapelayout
: to pass the layout object for cytoscape
Development
Requirements: Node.js version >=12.2.0
git clone https://github.com/vemonet/cytoscape-rdf.git
cd cytoscape-rdf
Install:
yarn
Run in development:
yarn dev
Build:
yarn build
Aknowledgments
Built with: