nlp - SPARQL how to deal with different cased queries? -


i still bit new sparql. have set dbpedia endpoint our company. have no idea end user querying and, since dbpedia case sensitive pass both title case & uppercase versions subjects vs person; e.g. "computer_programming" vs "alcia_keys". rather pass in 2 separate queries effecient way achieve this? i've tried in operator (from this question) seem failing somewhere.

select ?label ?abstract {    in (<http://dbpedia.org/resource/alicia_keys>, <http://dbpedia.org/resource/alicia_keys>) rdfs:label ?label;                dbpedia-owl:abstract ?abstract.                 }                 limit 1""" 

since dbpedia case sensitive pass both title case & uppercase versions subjects vs person; e.g. "computer_programming" vs "alcia_keys". rather pass in 2 separate queries effecient way achieve this?

uris should viewed opaque. while dbpedia has nice structure can lucky concatenating http://dbpedia.org/resource , string _ replacing , that's not robust way something. better idea note string you're getting same label of resource, modulo variations in case. given that, best idea same label, modulo case. e.g.,

select ?resource {   values ?input { "alicia keys" }    ?resource rdfs:label ?label .   filter ( ucase(str(?label)) = ucase(?input) ) } 

that's going pretty slow, though, because you'll have find every resource, string processing on label. it's ok approach, in principle though.

what can done make better? well, if know kind of thing you're looking for, lot. e.g., restrict query persons:

select distinct ?resource {   values ?input { "alicia keys" }    ?resource rdf:type dbpedia-owl:person ;             rdfs:label ?label .   filter ( ucase(str(?label)) = ucase(?input) ) } 

that's improvement, it's still not all fast. still, @ least conceptually, has touch each person , examine name. sparql endpoints support text indexing, , that's need if want efficiently.

the best option, of course, ask users little bit more information, , normalize data in advance. if user provides "alicia keys", you can normalization "alicia keys"@en, , ilke:

select distinct ?resource {   values ?input { "alicia keys"@en }   ?resource rdfs:label ?input . } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

jquery - Keeping Kendo Datepicker in min/max range -