Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Find predicates on an RDF whose structure forms a taxonomy, to be used in semantic measures.

Notifications You must be signed in to change notification settings

andrefs/rdf-hektos

Repository files navigation

rdf-hektos Node.js CI

Find predicates on an RDF whose structure forms a taxonomy, to be used in semantic measures.

Dependencies

  • docker
  • Apache Jena (tdb2.tdbloader)

Install

npm install

Run as a command line script with Apache Jena Fuseki on a Docker container

How to run for a knowledge graph KG:

  1. Create a folder on fuseki/data/kgs/$KG
  2. Inside fuseki/data/kgs/$KG put your N-Triples file and name it $KG.nt
  3. (cd fuseki; ./run.sh)
  4. npm run proc-graph (results will be saved in proc-$KG-results.json)
  5. npm run graph-to-csv proc-$KG-results.json (results will be saved in results.csv)

Example

Run rdf-hektos for WordNet:

  1. Download the wordnet.nt file (you can find it gzipped here).
  2. Unzip it if you need to.
  3. Create the folder on fuseki/kgs/wordnet and move the wordnet.nt file there.
  4. Run (cd fuseki; ./run.sh). This might take a couple minutes. The wordnet.nt file will be loaded into Apache Jena and the Fuseki container will start.
  5. You should now be able to access WordNet on Fuseki at http://localhost:3030.
  6. You can now run:
    1. npm run proc-graph. This will take a minute and output results to wordnet-metrics.json.
    2. npm graph-to-csv wordnet-metrics.json. This will output results to results.csv.

Use as a library

import { SparqlWebStore, roisToSubQ, procGraph } from "rdf-hektos";
const rois = ["http://example.org/A", "http://example.org/B"];
const subQ = roisToSubQ(rois, "s");
const endpointUrl = "http://localhost:3030/dataset/sparql";
const store = new SparqlWebStore({ endpointUrl });

const res = await procGraph(store, subQ, {});

TODO

  • Better integration of logs and progress bars with log-with-statusbar and ololog.

Bugs and stuff

Open a GitHub issue or, preferably, send me a pull request.

License

The MIT License (MIT)

Copyright (c) 2025 André Santos [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

About

Find predicates on an RDF whose structure forms a taxonomy, to be used in semantic measures.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published