This project demonstrates how to use YARRRML mappings to convert CSV data into RDF and then run reasoning and SPARQL queries over the generated triples. The project uses several libraries including @comake/rmlmapper-js, eyereasoner, Comunica, and N3.
-
index.mjs
- The first index.mjs is a self-contained script that:
- Converts a YARRRML mapping into an RML mapping.
- Uses
@comake/rmlmapper-jsto process a CSV file (calls.csv) and generate JSON-LD. - Converts JSON-LD to N-Triples.
- Runs reasoning with the EYE reasoner (via the
eyereasonerpackage) and saves the result inreasoning-result.n3. - Executes a SPARQL query using the Comunica query engine and logs aggregated medication statistics.
- The first index.mjs is a self-contained script that:
-
helpers.js Contains all the helper functions
-
package.json
Defines the project metadata, dependencies, and the start script. The key dependencies include:@comake/rmlmapper-js@comunica/query-sparql@rmlio/yarrrml-parsercsv-parseeyereasonern3jsonldcli-table3
npm installYou can run the project using the start script defined in package.json.
npm startor
node <index.mjs>This will execute the index.mjs file which:
-
Converts the YARRRML mapping.
-
Processes the CSV file to produce RDF triples.
-
Runs the EYE reasoner and outputs the reasoning results.
-
Executes a SPARQL query and prints the aggregated medication statistics.
When you run the scripts, several files are generated:
-
reasoner-input.n3: Input provided to the EYE reasoner.
-
reasoning-result.n3: The output of the reasoning process.
-
Check the console logs for detailed information on each step of the process.