v3.0.0+
| Status: | effective |
| Progress: | 100% |
| Version: | 3.0.0+ |
Demo:JSON - datatype export examples
From semantic-mediawiki.org
Please consider adopting examples to fit your environment since simple duplication may not create appropriate results.
Data presented on this page are for educational and demonstration purpose only.
| Table of Contents | |
|---|---|
Query with different datatypes[edit]
- Syntax
{{#ask:
[[Has_annotation_uri::+]]
|?Has_annotation_uri=anu
|?Has_boolean=boo
|?Has_code=cod
|?Has_date=dat
|?Has email address=ema
|?Has Wikidata item ID=eid
|?Has coordinates=geo
|?Has number=num
|?Has mlt=mlt
|?Has example=wpg
|?Telephone number=tel
|?Has temperatureExample=tem
|?Area=qty
|?SomeProperty=txt
|?Has Wikidata Reference=ref_rec
|?Soccer result=rec
|?Has_URL=uri
|format=json
|limit=1
}}
- Result as List
- List of datatypes (anu: https://www.semantic-mediawiki.org, boo: true, cod: Code, dat: 22 May 2015 17:32:00, ema: president@whitehouse.gov, geo: 32° 42' 54.00" N, 117° 9' 45.00" W, num: 47,000.11, mltGeneric property for monolingual text: Monoglingual text in english (en), Texte monoglinguel en français (fr), Einsprachiger Text auf Deutsch (de), wpg: Semantic MediaWiki, telThis property is a special property in this wiki.: +1-800-225-5288, tem: 296.15 K23 °C <br />73.4 °F <br />533.07 °R <br />, qty: 1,052.00 km²406.18 sqmi <br />, txt: Did you create the page for Tokyo 東京 ? Yes ✓, uri: http://www.whitehouse.gov)
is preserved but variables are expanded, e.g:
Help:List of datatypes
is displayed as the name of this page instead of FULLPAGENAME
- Result as json
- json source code
{
"printrequests": [
{
"label": "",
"key": "",
"redi": "",
"typeid": "_wpg",
"mode": 2,
"format": false
},
{
"label": "anu",
"key": "Has_annotation_uri",
"redi": "",
"typeid": "_anu",
"mode": 1,
"format": ""
},
{
"label": "boo",
"key": "Has_boolean",
"redi": "",
"typeid": "_boo",
"mode": 1,
"format": ""
},
{
"label": "cod",
"key": "Has_code",
"redi": "",
"typeid": "_cod",
"mode": 1,
"format": ""
},
{
"label": "dat",
"key": "Has_date",
"redi": "",
"typeid": "_dat",
"mode": 1,
"format": ""
},
{
"label": "ema",
"key": "Has_email_address",
"redi": "",
"typeid": "_ema",
"mode": 1,
"format": ""
},
{
"label": "eid",
"key": "Has_Wikidata_item_ID",
"redi": "",
"typeid": "_eid",
"mode": 1,
"format": ""
},
{
"label": "geo",
"key": "Has_coordinates",
"redi": "",
"typeid": "_geo",
"mode": 1,
"format": ""
},
{
"label": "num",
"key": "Has_number",
"redi": "",
"typeid": "_num",
"mode": 1,
"format": ""
},
{
"label": "mlt",
"key": "Has_mlt",
"redi": "",
"typeid": "_mlt_rec",
"mode": 1,
"format": ""
},
{
"label": "wpg",
"key": "Has_example",
"redi": "",
"typeid": "_wpg",
"mode": 1,
"format": ""
},
{
"label": "tel",
"key": "_tel",
"redi": "",
"typeid": "_tel",
"mode": 1,
"format": ""
},
{
"label": "tem",
"key": "Has_temperatureExample",
"redi": "",
"typeid": "_tem",
"mode": 1,
"format": ""
},
{
"label": "qty",
"key": "Area",
"redi": "",
"typeid": "_qty",
"mode": 1,
"format": ""
},
{
"label": "txt",
"key": "SomeProperty",
"redi": "",
"typeid": "_txt",
"mode": 1,
"format": ""
},
{
"label": "ref_rec",
"key": "Has_Wikidata_Reference",
"redi": "",
"typeid": "_ref_rec",
"mode": 1,
"format": ""
},
{
"label": "rec",
"key": "Soccer_result",
"redi": "",
"typeid": "_rec",
"mode": 1,
"format": ""
},
{
"label": "uri",
"key": "Has_URL",
"redi": "",
"typeid": "_uri",
"mode": 1,
"format": ""
}
],
"results": {
"Help:List of datatypes": {
"printouts": {
"anu": [
"https:\/\/www.semantic-mediawiki.org"
],
"boo": [
"t"
],
"cod": [
"Code\nis preserved but variables are expanded, e.g:\nHelp:List of datatypes\nis displayed as the name of this page instead of FULLPAGENAME"
],
"dat": [
{
"timestamp": "1432315920",
"raw": "1\/2015\/5\/22\/17\/32\/0\/0"
}
],
"ema": [
"mailto:president@whitehouse.gov"
],
"eid": [
"Q9682"
],
"geo": [
{
"lat": 32.715,
"lon": -117.1625
}
],
"num": [
47000.11
],
"mlt": [
{
"Text": {
"label": "Text",
"key": "_TEXT",
"typeid": "_txt",
"item": [
"Monoglingual text in english"
]
},
"Language code": {
"label": "Language code",
"key": "_LCODE",
"typeid": "__lcode",
"item": [
"en"
]
}
},
{
"Text": {
"label": "Text",
"key": "_TEXT",
"typeid": "_txt",
"item": [
"Texte monoglinguel en fran\u00e7ais"
]
},
"Language code": {
"label": "Language code",
"key": "_LCODE",
"typeid": "__lcode",
"item": [
"fr"
]
}
},
{
"Text": {
"label": "Text",
"key": "_TEXT",
"typeid": "_txt",
"item": [
"Einsprachiger Text auf Deutsch"
]
},
"Language code": {
"label": "Language code",
"key": "_LCODE",
"typeid": "__lcode",
"item": [
"de"
]
}
}
],
"wpg": [
{
"fulltext": "Semantic MediaWiki",
"fullurl": "https:\/\/www.semantic-mediawiki.org\/wiki\/Semantic_MediaWiki",
"namespace": 0,
"exists": "1",
"displaytitle": ""
}
],
"tel": [
"tel:+1-800-225-5288"
],
"tem": [
296.15
],
"qty": [
{
"value": 1052,
"unit": "km\u00b2"
}
],
"txt": [
"Did you create the page for Tokyo \u6771\u4eac ? Yes \u2713"
],
"ref_rec": [
{
"Has URL": {
"label": "Has URL",
"key": "Has_URL",
"typeid": "_uri",
"item": [
"https:\/\/en.wikipedia.org\/wiki\/Data_type"
]
},
"Has Wikidata item ID": {
"label": "Has Wikidata item ID",
"key": "Has_Wikidata_item_ID",
"typeid": "_eid",
"item": [
"Q190087"
]
}
}
],
"rec": [
{
"Soccer date": {
"label": "Soccer date",
"key": "Soccer_date",
"typeid": "_dat",
"item": [
{
"timestamp": "1426982400",
"raw": "1\/2015\/3\/22"
}
]
},
"Soccer home team": {
"label": "Soccer home team",
"key": "Soccer_home_team",
"typeid": "_wpg",
"item": [
{
"fulltext": "Bayern M\u00fcnchen",
"fullurl": "https:\/\/www.semantic-mediawiki.org\/wiki\/Bayern_M%C3%BCnchen",
"namespace": 0,
"exists": "",
"displaytitle": ""
}
]
},
"Soccer guest team": {
"label": "Soccer guest team",
"key": "Soccer_guest_team",
"typeid": "_wpg",
"item": [
{
"fulltext": "Borussia M\u00f6nchengladbach",
"fullurl": "https:\/\/www.semantic-mediawiki.org\/wiki\/Borussia_M%C3%B6nchengladbach",
"namespace": 0,
"exists": "1",
"displaytitle": ""
}
]
},
"Soccer homescore": {
"label": "Soccer homescore",
"key": "Soccer_homescore",
"typeid": "_num",
"item": [
0
]
},
"Soccer guestscore": {
"label": "Soccer guestscore",
"key": "Soccer_guestscore",
"typeid": "_num",
"item": [
2
]
}
}
],
"uri": [
"http:\/\/www.whitehouse.gov"
]
},
"fulltext": "Help:List of datatypes",
"fullurl": "https:\/\/www.semantic-mediawiki.org\/wiki\/Help:List_of_datatypes",
"namespace": 12,
"exists": "1",
"displaytitle": ""
}
},
"serializer": "SMW\\Serializers\\QueryResultSerializer",
"version": 2,
"rows": 1
}
List of datatype IDs[edit]
| ID | Datatype | Description | in this wiki | Help page | Provided by |
|---|---|---|---|---|---|
_anu | Annotation URI | Holds URIs, but has some technical differences during export compared to the "URL" type | Help:Datatype "Annotation URI" | Semantic MediaWiki | |
_boo | Boolean | Holds boolean (true/false) values | Help:Datatype "Boolean" | Semantic MediaWiki | |
_cod | Code | Holds technical, pre-formatted texts (similar to datatype Text) | Help:Datatype "Code" | Semantic MediaWiki | |
_dat | Date | Holds particular points in time | Help:Datatype "Date" | Semantic MediaWiki | |
_ema | Holds e-mail addresses | Help:Datatype "Email" | Semantic MediaWiki | ||
_eid | External identifier | Holds a value that associates it with with a external URI for formatting | Help:Datatype "External identifier" | Semantic MediaWiki | |
_geo | Geographic coordinates | Holds coordinates describing geographic locations | Help:Datatype "Geographic coordinates" | Maps (Semantic Maps) | |
_keyw | Keyword | Holds text of restricted length that is being normalised (similar to datatype Text) | Help:Datatype "Keyword" | Semantic MediaWiki | |
_mlt_rec | Monolingual text | Holds a text value that associates the annotation with a specific language code | Help:Datatype "Monolingual text" | Semantic MediaWiki | |
_num | Number | Holds integer and decimal numbers, with an optional exponent | Help:Datatype "Number" | Semantic MediaWiki | |
_wpg | Page | Holds names of wiki pages, and displays them as a link | Help:Datatype "Page" | Semantic MediaWiki | |
_qty | Quantity | Holds values that describe quantities, containing both a number and a unit | Help:Datatype "Quantity" | Semantic MediaWiki | |
_rec | Record | Holds compound property values that consist of a short list of values with fixed type and order | Help:Datatype "Record" | Semantic MediaWiki | |
_tel | Telephone number | Holds international telephone numbers based on the RFC 3966 standard | Help:Datatype "Telephone number" | Semantic MediaWiki | |
_tem | Temperature | Holds temperature values (similar to type Quantity) | Help:Datatype "Temperature" | Semantic MediaWiki | |
_txt | Text | Holds text of arbitrary length | Help:Datatype "Text" | Semantic MediaWiki | |
_ref_rec | Reference | Holds a value that associates it to individual defined provenance metadata record | Help:Datatype "Reference" | Semantic MediaWiki | |
_uri | URL | Holds URIs, URNs and URLs | Help:Datatype "URL" | Semantic MediaWiki |