Skip to content

Commit

Permalink
implicit prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lvaudor committed Oct 20, 2023
1 parent cdce3e0 commit e5bc85b
Show file tree
Hide file tree
Showing 5 changed files with 569 additions and 8 deletions.
8 changes: 7 additions & 1 deletion R/spq_perform.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,14 @@ spq_perform = function(.query,
)

if (replace_prefixes) {
endpoint_url=.query[["endpoint_info"]]$endpoint_url
if(endpoint_url %in% usual_endpoints$url){
endpoint_name=usual_endpoints$name[which(usual_endpoints$url==endpoint_url)]
prefixes=usual_prefixes$name[which(usual_prefixes$type==endpoint_name)]
}else{prefixes=c()}
prefixes=c(prefixes,.query[["prefixes_used"]])
results = purrr::reduce(
.query[["prefixes_used"]],
prefixes,
\(results, x) replace_prefix(x, results, .query = .query),
.init = results
)
Expand Down
14 changes: 7 additions & 7 deletions data-raw/usual_prefixes.csv
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
type,name,url
Wikidata,wd,http://www.wikidata.org/entity/
Wikidata,wdt,http://www.wikidata.org/prop/direct/
Wikidata,ps,http://www.wikidata.org/prop/statement/
Wikidata,psv,http://www.wikidata.org/prop/statement/value/
Wikidata,pq,http://www.wikidata.org/prop/qualifier/
Wikidata,p,http://www.wikidata.org/prop/
Wikidata,wikibase,http://wikiba.se/ontology#
wikidata,wd,http://www.wikidata.org/entity/
wikidata,wdt,http://www.wikidata.org/prop/direct/
wikidata,ps,http://www.wikidata.org/prop/statement/
wikidata,psv,http://www.wikidata.org/prop/statement/value/
wikidata,pq,http://www.wikidata.org/prop/qualifier/
wikidata,p,http://www.wikidata.org/prop/
wikidata,wikibase,http://wikiba.se/ontology#
dbpedia,dbo,http://dbpedia.org/ontology/
generic,foaf,http://xmlns.com/foaf/0.1/
generic,rdfs,http://www.w3.org/2000/01/rdf-schema#
Expand Down
Binary file modified data/usual_prefixes.rda
Binary file not shown.
Loading

0 comments on commit e5bc85b

Please sign in to comment.