SPARQL query performance with rdflib-sqlalchemy

≯℡__Kan透↙ 提交于 2019-12-12 17:15:06

问题


I have 7200 or so SKOS.Concept objects created by rdflib-sqlalchemy from parsing a turtle file stored in a Postgres DB.

The following SPARQL query takes over 30 seconds to respond with data:

 SELECT ?subject ?prefLabel
 WHERE { ?subject rdf:type 
 <http://www.w3.org/2004/02/skos/core#Concept> .
 ?subject skos:prefLabel ?prefLabel .
 FILTER (lang(?prefLabel) = 'en') } 
 order by ?prefLabel
 LIMIT 20 OFFSET 0

I am using the limit and offset to paginate through results. I pass in the language parameter (one of ar, en, es, fr, ru, zh).

If I simply select the subject, the resulting query is lightning fast -- but I need to collate by prefLabel in the result set.

This is a query that ran very fast in a key value store (Sleepycat) but crawls when moving to rdlib-sqlalchemy with a Postgres backend.

I am quite new to rdlif and SPARQL -- any suggestions or insights would be welcome.

Thanks in advance!

来源:https://stackoverflow.com/questions/49589527/sparql-query-performance-with-rdflib-sqlalchemy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!