Skip to content

Instantly share code, notes, and snippets.

View aljoshakoecher's full-sized avatar

Aljosha Koecher aljoshakoecher

  • Helmut Schmidt University
  • Hamburg, Germany
View GitHub Profile
@aljoshakoecher
aljoshakoecher / comunica-optional-bug.js
Last active July 15, 2024 10:50
This is a little script to test query behavior of Comunica with queries that contain an OPTIONAL part. In this current state (i.e. one line in rdfData commented out and OPTIONAL part last), it works. But if you swap line 40 with the OPTIONAL part in lines 41-43, no bindings are returned.
const { QueryEngine } = require("@comunica/query-sparql");
const { Store, Parser } = require("n3");
const rdfData = `
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ex: <http://example.org/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
ex:personA a ex:Person.
#ex:personA ex:hasName "Homer".
@aljoshakoecher
aljoshakoecher / test.js
Created July 5, 2024 20:04
Small script that shows a bug (?) in Comunica. An RDF dataset is parsed and stored in an N3Store and also imported into a local GraphDB (needs to be done manually). A query is executed against both the N3Store and the GraphDB instance. It returns valid results for the N3Store but causes an error when querying GraphDB
const { QueryEngine } = require("@comunica/query-sparql");
const { Store, Parser } = require("n3");
const rdfData = `
@prefix : </#>.
@prefix ont: <http://example.org/ontology#>.
@prefix m: <http://openmath.org/vocab/math#>.
ont:myApplication_equals
a m:Application;