Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Type Conversion #853

Open
tholzheim opened this issue Dec 27, 2022 · 0 comments
Open

Support for Type Conversion #853

tholzheim opened this issue Dec 27, 2022 · 0 comments

Comments

@tholzheim
Copy link

For sorting a query result I need to convert a string literal to an integer literal.
The STRDT function is currently not supported by QLever.

Error message:

Warning
ParseException, cause: Clause "STRDT(?volume_str,xsd:integer)" at line 17:9 Built-in functions (other than aggregates and REGEX) are currently not supported by QLever.

Example query

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> 
PREFIX p: <http://www.wikidata.org/prop/> 
PREFIX schema: <http://schema.org/> 
PREFIX wd: <http://www.wikidata.org/entity/> 
PREFIX wdt: <http://www.wikidata.org/prop/direct/> 
PREFIX wikibase: <http://wikiba.se/ontology#> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX ps: <http://www.wikidata.org/prop/statement/> 
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
SELECT DISTINCT ?item ?itemLabel ?volume_str ?volume_int 
WHERE { 
  ?item wdt:P31 wd:Q1143604; 
     wdt:P179 wd:Q27230297; 
     rdfs:label ?itemLabel. 
  FILTER((LANG(?itemLabel)) = "en")
  OPTIONAL { 
    ?item (p:P179/pq:P478) ?volume_str. 
    BIND(STRDT(?volume_str, xsd:integer) as ?volume_int)
    # alternative: BIND(xsd:integer(?volume_str) as ?volume_int)
  } 
} 
ORDER BY ?volume_int

Wikidata Query Service (WQS): https://w.wiki/69fw
QLever: https://qlever.cs.uni-freiburg.de/wikidata/ha05m6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant