comunica / comunica-feature-link-traversal

📬 Comunica packages for link traversal-based query execution
Other
8 stars 11 forks source link

Process stops on zeroOrMore path query #83

Closed jeswr closed 3 months ago

jeswr commented 1 year ago

Issue type:


Description:

The following script will exit without logging a result. This script will work if the path is made to be just (rdfs:subClassOf*/^rdfs:domain/rdfs:range), but breaks if * or + are applied. ~It will also work for a variety of other subjects including foaf:Document.~

import { QueryEngine } from '@comunica/query-sparql-link-traversal';
import { DataFactory as DF } from 'n3';

async function main() {
  const engine = new QueryEngine();

  const results = await engine.queryBindings(`
  PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
  PREFIX foaf: <http://xmlns.com/foaf/0.1/>

  SELECT ?type WHERE { 
      foaf:Group (rdfs:subClassOf*/^rdfs:domain/rdfs:range)* ?type
  }`,
    {
      sources: [
        "https://web.archive.org/web/20220614105937if_/http://xmlns.com/foaf/spec/20140114.rdf"
      ],
      lenient: true,
    }
  )
  const arr = await results.toArray();
  console.log(arr.map(r => r.get('type')))
}

main();

~Note that in the case where the path is just (rdfs:subClassOf*/^rdfs:domain/rdfs:range) foaf:Group has no results whilst foaf:Document has at least one. I suspect this is the root cause of the problem.~


Environment:

Package version ^0.0.2-alpha.6.0` Node Version 18.8.0

Crash log:

github-actions[bot] commented 1 year ago

Thanks for reporting!

jeswr commented 1 year ago

I have also tried this with the alternative script in https://github.com/comunica/comunica-feature-link-traversal/issues/84#issue-1416122235. In that instance it stops after about ~4 min. The output logged by the proxy is:

404
200 http://wayback.archive-it.org/all/20211020094933/http://xmlns.com/foaf/spec/20140114.rdf
new request [object Request]
404
200 http://wayback.archive-it.org/all/20211020094933/http://xmlns.com/foaf/spec/20140114.rdf
new request [object Request]
404
404
404
200
res http://www.w3.org/2002/07/owl http://www.w3.org/2002/07/owl
404
404
404
200
res http://www.w3.org/2000/01/rdf-schema http://www.w3.org/2000/01/rdf-schema
404
404
404
200
res http://www.w3.org/2003/01/geo/wgs84_pos http://www.w3.org/2003/01/geo/wgs84_pos
404
404
404
404
404
404
404
200
res http://xmlns.com/foaf/0.1/Person http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/Image http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/sha1 http://xmlns.com/foaf/0.1/
200
res http://www.w3.org/2002/07/owl http://www.w3.org/2002/07/owl
200
res http://xmlns.com/foaf/0.1/Organization http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/Group http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/mbox http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/Document http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/icqChatID http://xmlns.com/foaf/0.1/
200
res http://www.w3.org/2000/01/rdf-schema http://www.w3.org/2000/01/rdf-schema
200
res http://xmlns.com/foaf/0.1/Agent http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/geekcode http://xmlns.com/foaf/0.1/
200
res http://www.w3.org/2003/01/geo/wgs84_pos http://www.w3.org/2003/01/geo/wgs84_pos
200
res http://xmlns.com/foaf/0.1/logo http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/plan http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/topic http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/topic_interest http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/img http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/pastProject http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/based_near http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/schoolHomepage http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/fundedBy http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/myersBriggs http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/family_name http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/theme http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/yahooChatID http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/workInfoHomepage http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/publications http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/page http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/dnaChecksum http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/knows http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/thumbnail http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/homepage http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/surname http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/currentProject http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/aimChatID http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/depicts http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/msnChatID http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/name http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/interest http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/depiction http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/jabberID http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/mbox_sha1sum http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/workplaceHomepage http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/weblog http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/made http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/firstName http://xmlns.com/foaf/0.1/
404 http://wayback.archive-it.org/all/20140422175911/http://xmlns.com/foaf/0.1/PersonalProfileDocument
res http://xmlns.com/foaf/0.1/PersonalProfileDocument http://xmlns.com/foaf/0.1/PersonalProfileDocument
200
res http://www.w3.org/2004/02/skos/core http://www.w3.org/2009/08/skos-reference/skos.rdf
200
res http://xmlns.com/foaf/0.1/Image http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/Person http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/sha1 http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/mbox http://xmlns.com/foaf/0.1/
404
404
200
res http://xmlns.com/foaf/0.1/Agent http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/geekcode http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/Document http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/Group http://xmlns.com/foaf/0.1/
404
200
res http://xmlns.com/foaf/0.1/Organization http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/icqChatID http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/img http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/msnChatID http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/pastProject http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/myersBriggs http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/workplaceHomepage http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/name http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/knows http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/interest http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/homepage http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/fundedBy http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/based_near http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/jabberID http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/aimChatID http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/page http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/topic http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/schoolHomepage http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/yahooChatID http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/depiction http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/currentProject http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/firstName http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/publications http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/plan http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/surname http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/theme http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/family_name http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/made http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/workInfoHomepage http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/logo http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/dnaChecksum http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/thumbnail http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/weblog http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/topic_interest http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/mbox_sha1sum http://xmlns.com/foaf/0.1/
200
res http://xmlns.com/foaf/0.1/depicts http://xmlns.com/foaf/0.1/
404
404 http://wayback.archive-it.org/all/20140422175911/http://xmlns.com/foaf/0.1/PersonalProfileDocument
res http://xmlns.com/foaf/0.1/PersonalProfileDocument http://xmlns.com/foaf/0.1/PersonalProfileDocument
200
res http://www.w3.org/2004/02/skos/core http://www.w3.org/2009/08/skos-reference/skos.rdf
404
404
404 http://wayback.archive-it.org/all/20220806001805/http://xmlns.com/foaf/0.1/maker
res http://xmlns.com/foaf/0.1/maker http://xmlns.com/foaf/0.1/maker
404
404
404
200 http://wayback.archive-it.org/all/20200914214412/http://xmlns.com/foaf/spec/
new request [object Request]
200
res http://www.w3.org/1999/02/22-rdf-syntax-ns http://www.w3.org/1999/02/22-rdf-syntax-ns
200
res http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema
200 http://wayback.archive-it.org/all/20210622113104/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20210610163120/http://xmlns.com/foaf/spec/
new request [object Request]
404
200
res http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema
404
200 http://wayback.archive-it.org/all/20190311140316/http://xmlns.com/foaf/spec/
new request [object Request]
404
404
200 http://wayback.archive-it.org/all/20200914214412/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20190927101030/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20190903131611/http://xmlns.com/foaf/spec/
new request [object Request]
404
404
404
200 http://wayback.archive-it.org/all/20190311140316/http://xmlns.com/foaf/spec/
new request [object Request]
404
404 http://wayback.archive-it.org/all/20220806001805/http://xmlns.com/foaf/0.1/maker
res http://xmlns.com/foaf/0.1/maker http://xmlns.com/foaf/0.1/maker
200 http://wayback.archive-it.org/all/20181228000127/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20210622113104/http://xmlns.com/foaf/spec/
new request [object Request]
404
200 http://wayback.archive-it.org/all/20210610163120/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20200914214412/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20200914214412/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20190903131611/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20190927101030/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20190311140316/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20190311140316/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20200926204227/http://xmlns.com/foaf/spec/
new request [object Request]
404
200 http://wayback.archive-it.org/all/20200926204227/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20181228000127/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
404
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
404
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
404
404
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
404
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
404
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
404
404
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
404
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
404
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
404
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
200
res http://www.w3.org/2000/10/swap/pim/contact http://www.w3.org/2000/10/swap/pim/contact
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
200
res http://www.w3.org/2000/10/swap/pim/contact http://www.w3.org/2000/10/swap/pim/contact
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
200 http://wayback.archive-it.org/all/20130906013933/http://xmlns.com/foaf/spec/
new request [object Request]
rubensworks commented 1 year ago

This looks like a bug in the ZeroOrMore actor, and is probably unrelated to link traversal. We could confirm this by loading up this data into an N3Store, and querying it with query-sparql.

jeswr commented 1 year ago

I tried your suggestion in addition to just running

import { QueryEngine } from '@comunica/query-sparql';

async function main() {
  const engine = new QueryEngine();

  const results = await engine.queryBindings(`
  PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
  PREFIX foaf: <http://xmlns.com/foaf/0.1/>

  SELECT ?type WHERE { 
      foaf:Group (rdfs:subClassOf*/^rdfs:domain/rdfs:range)* ?type
  }`, {
    sources: [
      "http://wayback.archive-it.org/all/20211020094933/http://xmlns.com/foaf/spec/20140114.rdf",
      "http://www.w3.org/2002/07/owl",
      "http://www.w3.org/2000/01/rdf-schema",
      "http://www.w3.org/2003/01/geo/wgs84_pos",
      "http://www.w3.org/2009/08/skos-reference/skos.rdf",
      "http://www.w3.org/2000/10/swap/pim/contact"
      "http://www.w3.org/2001/XMLSchema",
    ]
  });

  const arr = await results.toArray();
  console.log(arr.map(r => r.get('type')))
}

main();

Both appear to work fine - producing the following output

[
  NamedNode {
    termType: 'NamedNode',
    value: 'http://xmlns.com/foaf/0.1/Group'
  },
  NamedNode { id: 'http://xmlns.com/foaf/0.1/Agent' },
  NamedNode { id: 'http://www.w3.org/2002/07/owl#Thing' },
  NamedNode { id: 'http://www.w3.org/2000/01/rdf-schema#Literal' },
  NamedNode { id: 'http://www.w3.org/2000/01/rdf-schema#Resource' },
  NamedNode { id: 'http://xmlns.com/foaf/0.1/Document' },
  NamedNode { id: 'http://xmlns.com/foaf/0.1/OnlineAccount' },
  NamedNode { id: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#List' },
  NamedNode { id: 'http://xmlns.com/foaf/0.1/Image' }
]
jeswr commented 1 year ago

Then I just tried with the following which failed ...

import { QueryEngine } from '@comunica/query-sparql';

async function main() {
  const engine = new QueryEngine();

  const results = await engine.queryBindings(`
  PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
  PREFIX foaf: <http://xmlns.com/foaf/0.1/>

  SELECT ?type WHERE { 
      foaf:Group (rdfs:subClassOf*/^rdfs:domain/rdfs:range)* ?type
  }`, {
    sources: [
      "http://wayback.archive-it.org/http://xmlns.com/foaf/spec/20140114.rdf",
      "http://wayback.archive-it.org/http://xmlns.com/foaf/spec/20140114.rdf",
      "http://xmlns.com/foaf/0.1/Person",
      "http://xmlns.com/foaf/0.1/Agent",
      "http://www.w3.org/2003/01/geo/wgs84_pos",
      "http://xmlns.com/foaf/0.1/Organization",
      "http://xmlns.com/foaf/0.1/Group",
      "http://xmlns.com/foaf/0.1/Image",
      "http://xmlns.com/foaf/0.1/Document",
      "http://xmlns.com/foaf/0.1/PersonalProfileDocument",
      "http://xmlns.com/foaf/0.1/OnlineAccount",
      "http://www.w3.org/2002/07/owl",
      "http://xmlns.com/foaf/0.1/OnlineGamingAccount",
      "http://xmlns.com/foaf/0.1/OnlineEcommerceAccount",
      "http://xmlns.com/foaf/0.1/OnlineChatAccount",
      "http://xmlns.com/foaf/0.1/mbox",
      "http://xmlns.com/foaf/0.1/mbox_sha1sum",
      "http://www.w3.org/2000/01/rdf-schema",
      "http://xmlns.com/foaf/0.1/gender",
      "http://xmlns.com/foaf/0.1/geekcode",
      "http://xmlns.com/foaf/0.1/dnaChecksum",
      "http://xmlns.com/foaf/0.1/sha1",
      "http://xmlns.com/foaf/0.1/based_near",
      "http://xmlns.com/foaf/0.1/jabberID",
      "http://xmlns.com/foaf/0.1/aimChatID",
      "http://xmlns.com/foaf/0.1/skypeID",
      "http://xmlns.com/foaf/0.1/icqChatID",
      "http://xmlns.com/foaf/0.1/yahooChatID",
      "http://xmlns.com/foaf/0.1/msnChatID",
      "http://xmlns.com/foaf/0.1/name",
      "http://xmlns.com/foaf/0.1/firstName",
      "http://xmlns.com/foaf/0.1/lastName",
      "http://xmlns.com/foaf/0.1/surname",
      "http://xmlns.com/foaf/0.1/family_name",
      "http://xmlns.com/foaf/0.1/familyName",
      "http://xmlns.com/foaf/0.1/homepage",
      "http://xmlns.com/foaf/0.1/weblog",
      "http://xmlns.com/foaf/0.1/openid",
      "http://xmlns.com/foaf/0.1/tipjar",
      "http://xmlns.com/foaf/0.1/plan",
      "http://xmlns.com/foaf/0.1/made",
      "http://xmlns.com/foaf/0.1/maker",
      "http://xmlns.com/foaf/0.1/img",
      "http://xmlns.com/foaf/0.1/depiction",
      "http://xmlns.com/foaf/0.1/depicts",
      "http://xmlns.com/foaf/0.1/thumbnail",
      "http://xmlns.com/foaf/0.1/myersBriggs",
      "http://xmlns.com/foaf/0.1/workplaceHomepage",
      "http://xmlns.com/foaf/0.1/workInfoHomepage",
      "http://xmlns.com/foaf/0.1/schoolHomepage",
      "http://xmlns.com/foaf/0.1/knows",
      "http://xmlns.com/foaf/0.1/interest",
      "http://xmlns.com/foaf/0.1/topic_interest",
      "http://xmlns.com/foaf/0.1/publications",
      "http://xmlns.com/foaf/0.1/currentProject",
      "http://xmlns.com/foaf/0.1/pastProject",
      "http://xmlns.com/foaf/0.1/fundedBy",
      "http://xmlns.com/foaf/0.1/logo",
      "http://xmlns.com/foaf/0.1/topic",
      "http://xmlns.com/foaf/0.1/primaryTopic",
      "http://xmlns.com/foaf/0.1/focus",
      "http://www.w3.org/2004/02/skos/core",
      "http://xmlns.com/foaf/0.1/isPrimaryTopicOf",
      "http://xmlns.com/foaf/0.1/page",
      "http://xmlns.com/foaf/0.1/theme",
      "http://xmlns.com/foaf/0.1/Person",
      "http://xmlns.com/foaf/0.1/Agent",
      "http://www.w3.org/2003/01/geo/wgs84_pos",
      "http://xmlns.com/foaf/0.1/Organization",
      "http://xmlns.com/foaf/0.1/Group",
      "http://xmlns.com/foaf/0.1/Image",
      "http://xmlns.com/foaf/0.1/Document",
      "http://xmlns.com/foaf/0.1/PersonalProfileDocument",
      "http://xmlns.com/foaf/0.1/OnlineAccount",
      "http://www.w3.org/2002/07/owl",
      "http://xmlns.com/foaf/0.1/OnlineGamingAccount",
      "http://xmlns.com/foaf/0.1/OnlineEcommerceAccount",
      "http://xmlns.com/foaf/0.1/OnlineChatAccount",
      "http://xmlns.com/foaf/0.1/mbox",
      "http://xmlns.com/foaf/0.1/mbox_sha1sum",
      "http://www.w3.org/2000/01/rdf-schema",
      "http://xmlns.com/foaf/0.1/gender",
      "http://xmlns.com/foaf/0.1/geekcode",
      "http://xmlns.com/foaf/0.1/dnaChecksum",
      "http://xmlns.com/foaf/0.1/sha1",
      "http://xmlns.com/foaf/0.1/based_near",
      "http://xmlns.com/foaf/0.1/jabberID",
      "http://xmlns.com/foaf/0.1/aimChatID",
      "http://xmlns.com/foaf/0.1/skypeID",
      "http://xmlns.com/foaf/0.1/icqChatID",
      "http://xmlns.com/foaf/0.1/yahooChatID",
      "http://xmlns.com/foaf/0.1/msnChatID",
      "http://xmlns.com/foaf/0.1/name",
      "http://xmlns.com/foaf/0.1/firstName",
      "http://xmlns.com/foaf/0.1/lastName",
      "http://xmlns.com/foaf/0.1/surname",
      "http://xmlns.com/foaf/0.1/family_name",
      "http://xmlns.com/foaf/0.1/familyName",
      "http://xmlns.com/foaf/0.1/homepage",
      "http://xmlns.com/foaf/0.1/weblog",
      "http://xmlns.com/foaf/0.1/openid",
      "http://xmlns.com/foaf/0.1/tipjar",
      "http://xmlns.com/foaf/0.1/plan",
      "http://xmlns.com/foaf/0.1/made",
      "http://xmlns.com/foaf/0.1/maker",
      "http://xmlns.com/foaf/0.1/img",
      "http://xmlns.com/foaf/0.1/depiction",
      "http://xmlns.com/foaf/0.1/depicts",
      "http://xmlns.com/foaf/0.1/thumbnail",
      "http://xmlns.com/foaf/0.1/myersBriggs",
      "http://xmlns.com/foaf/0.1/workplaceHomepage",
      "http://xmlns.com/foaf/0.1/workInfoHomepage",
      "http://xmlns.com/foaf/0.1/schoolHomepage",
      "http://xmlns.com/foaf/0.1/knows",
      "http://xmlns.com/foaf/0.1/interest",
      "http://xmlns.com/foaf/0.1/topic_interest",
      "http://xmlns.com/foaf/0.1/publications",
      "http://xmlns.com/foaf/0.1/currentProject",
      "http://xmlns.com/foaf/0.1/pastProject",
      "http://xmlns.com/foaf/0.1/fundedBy",
      "http://xmlns.com/foaf/0.1/logo",
      "http://xmlns.com/foaf/0.1/topic",
      "http://xmlns.com/foaf/0.1/primaryTopic",
      "http://xmlns.com/foaf/0.1/focus",
      "http://www.w3.org/2004/02/skos/core",
      "http://xmlns.com/foaf/0.1/isPrimaryTopicOf",
      "http://xmlns.com/foaf/0.1/page",
      "http://xmlns.com/foaf/0.1/theme",
      "http://xmlns.com/foaf/0.1/account",
      "http://xmlns.com/foaf/0.1/account",
      "http://xmlns.com/foaf/0.1/holdsAccount",
      "http://xmlns.com/foaf/0.1/holdsAccount",
      "http://xmlns.com/foaf/0.1/accountServiceHomepage",
      "http://xmlns.com/foaf/0.1/accountName",
      "http://xmlns.com/foaf/0.1/accountServiceHomepage",
      "http://xmlns.com/foaf/0.1/accountName",
      "http://xmlns.com/foaf/0.1/member",
      "http://xmlns.com/foaf/0.1/birthday",
      "http://xmlns.com/foaf/0.1/age",
      "http://xmlns.com/foaf/0.1/status",
      "http://www.w3.org/1999/02/22-rdf-syntax-ns",
      "http://xmlns.com/foaf/0.1/member",
      "http://xmlns.com/foaf/0.1/birthday",
      "http://xmlns.com/foaf/0.1/age",
      "http://xmlns.com/foaf/0.1/status",
      "http://www.w3.org/1999/02/22-rdf-syntax-ns",
      "http://www.w3.org/2001/XMLSchema",
      "http://www.w3.org/2001/XMLSchema",
    ],
    lenient: true
  });

  const arr = await results.toArray();
  console.log(arr.map(r => r.get('type')))
}

main();
jeswr commented 1 year ago

This is where it gets ... weird. The following fails

import { QueryEngine } from '@comunica/query-sparql';

async function main() {
  const engine = new QueryEngine();

  const results = await engine.queryBindings(`
  PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
  PREFIX foaf: <http://xmlns.com/foaf/0.1/>

  SELECT ?type WHERE { 
      foaf:Group (rdfs:subClassOf*/^rdfs:domain/rdfs:range)* ?type
  }`, {
    sources: [
      "http://wayback.archive-it.org/http://xmlns.com/foaf/spec/20140114.rdf",
      "http://www.w3.org/2003/01/geo/wgs84_pos",
      "http://www.w3.org/2002/07/owl",
      "http://www.w3.org/2000/01/rdf-schema",
      "http://www.w3.org/2004/02/skos/core",
      "http://www.w3.org/2003/01/geo/wgs84_pos",
      "http://www.w3.org/2002/07/owl",
      "http://www.w3.org/2000/01/rdf-schema",
      "http://www.w3.org/2004/02/skos/core",
      "http://www.w3.org/1999/02/22-rdf-syntax-ns",
      "http://www.w3.org/2001/XMLSchema",
    ],
    lenient: true
  });

  const arr = await results.toArray();
  console.log(arr.map(r => r.get('type')))
}

main();

But it succeeds if we remove the first reference to "http://www.w3.org/2002/07/owl" from the sources.

NOTE This holds true of whether or not lenient mode is enabled.

jeswr commented 1 year ago

Honestly based on this I suspect the culprit is iterator weirdness in https://github.com/comunica/comunica/blob/a856f18ab185186bb9de804ac7bc526a1ae5e1ef/packages/actor-rdf-resolve-quad-pattern-hypermedia/lib/MediatedLinkedRdfSourcesAsyncRdfIterator.ts

rubensworks commented 3 months ago

Seems to be working fine now in Comunica v3.