qlever
qlever copied to clipboard
feature request: implementation of xsd:integer()
As for example in this Scholia query:
# tool: scholia
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT
(xsd:integer(?count_) AS ?count)
(CONCAT("Total chemicals with ", ?description_) AS ?description)
WHERE {
BIND("haswbstatement:P31=Q113145171|P31=Q59199015" AS ?constraint)
VALUES (?description_ ?property_query_term) {
("or without stereochemistry" "")
("fully defined stereochemistry" "P31=Q113145171")
("undefined stereochemistry" "P31=Q59199015")
("CAS registry number" "P231")
("canonical SMILES" "P233")
("InChI" "P234")
("InChIKey" "P235")
("chemical formula" "P274")
# ("ChEMBL ID" "P592") # limit IDs
# ("ChemSpider ID" "P661") # limit IDs
("PubChem ID" "P662")
# ("KEGG ID" "P665") # limit IDs
("ChEBI ID" "P683")
("found in taxon" "P703")
("isomeric SMILES" "P2017")
# ("ZINC ID" "P2084") # limit IDs
("crystal structure" "haswbstatement:P3636|P11375")
("safety classification and labelling" "P4952")
("mass spectrum" "haswbstatement:P4964|P6689")
# ("SMARTS notation" "P8533") # not for now
("NMR spectrum" "P9405")
# hacky way to get quantity properties.
("pKa" "linksto:Property:P1117")
("mass" "linksto:Property:P2067")
("solubility" "linksto:Property:P2177")
("melting point" "linksto:Property:P2101")
("boiling point" "linksto:Property:P2102")
("electric dipole moment" "linksto:Property:P2201")
("ionization energy" "linksto:Property:P2260")
# ("minimum explosive concentration" "linksto:Property:P2204") # safety
# ("time-weighted average exposure limit" "linksto:Property:P2404") # safety
# ("ceiling exposure limit" "linksto:Property:P2405") # safety
# ("maximum peak exposure limit" "linksto:Property:P2406") # safety
# ("short-term exposure limit" "linksto:Property:P2407") # safety
# ("solubility product constant" "linksto:Property:P11813") # less than 5 statements
}
BIND(CONCAT(?property_query_term, " ", ?constraint) AS ?search_query)
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "www.wikidata.org" ;
wikibase:api "Search" ;
wikibase:limit "once" ;
mwapi:srsearch ?search_query;
mwapi:srlimit "1".
?count_ wikibase:apiOutput "//searchinfo[1]/@totalhits".
}
}
ORDER BY DESC(?count)
@egonw Thanks for the example query. Can you explain the use/need of xsd:integer
here`? There are three questions:
- Why
xsd:integer
(which stands for integers of arbitrary size, rarely needed) and notxsd:int
(integers with normal 8-byte precision)? - Why any conversion at all? Is the
?count_
returned by theSERVICE
clause a string? - What does the
SERVICE
query do? it does not work, even on the WSQD: try it.
Can you explain the use/need of
xsd:integer
here`?
No, but the first sounds arbitrary. The wikibase:mwapi
is using a special index, making it faster enough, and can possibly be removed from the Qlever version, being much faster.
I only filed it because the methods was not implemented and someone else also asked about it. I have started generalizing the Scholia code to run on the Qlever Wikidata endpoint, but running into a mix of issues.
Do you have an overview of things not implemented yet, but known? So that I know it's on your team's radar already?
- What does the
SERVICE
query do? it does not work, even on the WDQS
It does, not before the filling in of the search_query
value, a combination of a property and the haswbstatement:P31=Q113145171|P31=Q59199015
value. So, for example like this.
#1332 Was just merged, which adds the functions xsd:int[eger]
that convert strings to ints.
They will currently however wrongly convert values that are already numeric to undefined, so I am leaving this issue open for now, until these functions are fully implemented.
Did #1332 regress? I’m getting this error when querying for places and their populations in OSM:
Not supported: Function "<http://www.w3.org/2001/XMLSchema#int>" is currently not supported by QLever.
@1ec5 I have built a new index over the weekend (for the latest planet-240513.osm.pbf) and inadvertently started it with a version of QLever from a month ago. It's now the latest version again. Thanks for pointing this out to us.
PS: We are currently running some experiments on the machine hosting https://qlever.cs.uni-freiburg.de/osm-planet . So queries will be slower than usual for some periods.
This has been fixed for a while, so I am closing it.