Comments (3)
what is the query that generated this result?
so far, the value parsing is based on the type (but is probably incomplete): this could be completed (or replaced?) by a switch on the datatype
from wikibase-sdk.
Such results can also come from SPARQL functions for instance COUNT:
$ cat query
SELECT (COUNT(?p) AS ?c) WHERE { wd:Q42 ?p ?v }
$ wdsparql query
{
"head" : {
"vars" : [ "c" ]
},
"results" : {
"bindings" : [ {
"c" : {
"datatype" : "http://www.w3.org/2001/XMLSchema#integer",
"type" : "literal",
"value" : "432"
}
} ]
}
}
$ wdsparql --simplify query
[
"432"
]
Looking at https://www.mediawiki.org/wiki/Wikibase/Indexing/RDF_Dump_Format I found data types xsd:decimal, xsd:integer, and xsd:dateTime (the latter not numeric) to be expected from Wikidata values. For instance this will get you a xsd:decmial:
SELECT ?e WHERE { wd:Q193 wdt:P1096 ?e }
Using other SPARQL features one can also get xsd:float, xsd:double, and (!) xsd:boolean, for instance:
SELECT (bound(?y) AS ?exists) WHERE {
wd:Q1 wdt:P580 ?x . OPTIONAL { wd:Q1 wdt:P99999 ?y }
} LIMIT 1
I will submit a pull request do handle these cases!
from wikibase-sdk.
solved by 8d340da
from wikibase-sdk.
Related Issues (20)
- Entity Language Type is incorrect HOT 1
- Types of multiple things are sometimes confusing
- Create dedicated simplifySparqlResultsOneVariable function HOT 1
- Circular Dependencies, Uncaught ReferenceError: can't access lexical declaration 'simplifyEntities' before initialization HOT 7
- Network request failed error HOT 4
- No "export" main defined in package.json HOT 3
- given isEntityId examples all return true
- Convenience module for CommonJS HOT 8
- More examples/samples HOT 2
- Date formatting using moment.js HOT 2
- Musical notation claim parser isn't implemented HOT 5
- Support non-default script path HOT 2
- Support for tabular data HOT 1
- Where are the types definitions as claimed in npm? HOT 2
- Can't resolve 'querystring' HOT 1
- Missing types library HOT 13
- Idea: ActivityStreams JSON-LD HOT 1
- Uncaught (in promise) Error: missing a title HOT 4
- Missing .prettierrc HOT 9
- Compilation fails with latest version HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wikibase-sdk.