Queries

From Wikisphere
Revision as of 10:42, 27 January 2024 by Admin (talk | contribs)
Jump to navigation Jump to search
{{#visualdataquery:[[name::Afghanistan]] [[states/name::Badakhshan]]
|schema=Country 
|?states/cities/name
|?states/cities/latitude
|?states/cities/longitude
|format=datatable 
}} 
page titleNameLatitudeLongitude
Data:Countries/Afghanistan

Ashkāsham

36.68333

71.53333

Data:Countries/Afghanistan

Fayzabad

37.11664

70.58002

Data:Countries/Afghanistan

Jurm

36.86477

70.83421

Data:Countries/Afghanistan

Khandūd

36.95127

72.318

Data:Countries/Afghanistan

Rāghistān

37.66079

70.67346

Data:Countries/Afghanistan

Wākhān

37.0571

73.34928

{{#visualdataquery:[[name::Afghanistan]]   [[states/name::Badakhshan]] [[states/cities/name::A~]][[states/cities/latitude::36.68333000]] [[states/cities/restaurants/name::bbb]]      
|schema=Country   
|?states/cities/name
|?states/cities/latitude
|format=datatable 
}} 
page titleNameLatitude
Data:Countries/Afghanistan

Ashkāsham

36.68333

{{#visualdataquery:[[name::Afghanistan]]   [[states/name::Badakhshan]] [[states/cities/name::A~]][[states/cities/restaurants/name::bbb]]      
|schema=Country   
|?states/cities/name
|?states/cities/latitude
|?states/cities/longitude
|format=json 
|hierarchical-conditions=true 
|pagetitle-name=article 
}} 
page title"Data:Countries/Afghanistan"
data
states
cities
name"Ashkāsham"
latitude"36.68333"
longitude"71.53333"


{{#visualdataquery:[[name::Afghanistan]]
|schema=Country 
|?states/name
|?states/state_code
|format=table 
}}
page titleNameState code
Data:Countries/Afghanistan

Badakhshan

BDS

Data:Countries/Afghanistan

Badghis

BDG

Data:Countries/Afghanistan

Baghlan

BGL

Data:Countries/Afghanistan

Balkh

BAL

Data:Countries/Afghanistan

Bamyan

BAM

Data:Countries/Afghanistan

Daykundi

DAY

Data:Countries/Afghanistan

Farah

FRA

Data:Countries/Afghanistan

Faryab

FYB

Data:Countries/Afghanistan

Ghazni

GHA

Data:Countries/Afghanistan

Ghōr

GHO

Data:Countries/Afghanistan

Helmand

HEL

Data:Countries/Afghanistan

Herat

HER

Data:Countries/Afghanistan

Jowzjan

JOW

Data:Countries/Afghanistan

Kabul

KAB

Data:Countries/Afghanistan

Kandahar

KAN

Data:Countries/Afghanistan

Kapisa

KAP

Data:Countries/Afghanistan

Khost

KHO

Data:Countries/Afghanistan

Kunar

KNR

Data:Countries/Afghanistan

Kunduz Province

KDZ

Data:Countries/Afghanistan

Laghman

LAG

Data:Countries/Afghanistan

Logar

LOG

Data:Countries/Afghanistan

Nangarhar

NAN

Data:Countries/Afghanistan

Nimruz

NIM

Data:Countries/Afghanistan

Nuristan

NUR

Data:Countries/Afghanistan

Paktia

PIA

Data:Countries/Afghanistan

Paktika

PKA

Data:Countries/Afghanistan

Panjshir

PAN

Data:Countries/Afghanistan

Parwan

PAR

Data:Countries/Afghanistan

Samangan

SAM

Data:Countries/Afghanistan

Sar-e Pol

SAR

Data:Countries/Afghanistan

Takhar

TAK

Data:Countries/Afghanistan

Urozgan

URU

Data:Countries/Afghanistan

Zabul

ZAB

 
{{#visualdataquery:
[[name::Canada]][[states/name::Q~]]
|schema=Country
|?states/name 
|?states/cities/name 
|?states/cities/latitude 
|limit=50
|format=datatable 
}}
page titleNameNameLatitude
Data:Countries/Canada

Quebec

Abitibi-Témiscamingue

48.10018

Data:Countries/Canada

Quebec

Acton Vale

45.65007

Data:Countries/Canada

Quebec

Adstock

46.05007

Data:Countries/Canada

Quebec

Albanel

48.88324

Data:Countries/Canada

Quebec

Alma

48.55009

Data:Countries/Canada

Quebec

Amos

48.56688

Data:Countries/Canada

Quebec

Amqui

48.46382

Data:Countries/Canada

Quebec

Ange-Gardien

45.35008

Data:Countries/Canada

Quebec

Asbestos

45.76678

Data:Countries/Canada

Quebec

Baie-Comeau

49.21679

Data:Countries/Canada

Quebec

Baie-D'Urfé

45.41397

Data:Countries/Canada

Quebec

Baie-Saint-Paul

47.44109

Data:Countries/Canada

Quebec

Barraute

48.43349

Data:Countries/Canada

Quebec

Bas-Saint-Laurent

48.0503

Data:Countries/Canada

Quebec

Beaconsfield

45.43341

Data:Countries/Canada

Quebec

Beauceville

46.21785

Data:Countries/Canada

Quebec

Beauharnois

45.31341

Data:Countries/Canada

Quebec

Beaupré

47.04428

Data:Countries/Canada

Quebec

Bécancour

46.34106

Data:Countries/Canada

Quebec

Bedford

45.11678

Data:Countries/Canada

Quebec

Beloeil

45.56839

Data:Countries/Canada

Quebec

Berthierville

46.08336

Data:Countries/Canada

Quebec

Blainville

45.66678

Data:Countries/Canada

Quebec

Bois-des-Filion

45.66678

Data:Countries/Canada

Quebec

Boisbriand

45.61678

Data:Countries/Canada

Quebec

Bonaventure

48.04573

Data:Countries/Canada

Quebec

Boucherville

45.59104

Data:Countries/Canada

Quebec

Breakeyville

46.68037

Data:Countries/Canada

Quebec

Bromont

45.31678

Data:Countries/Canada

Quebec

Brossard

45.45008

Data:Countries/Canada

Quebec

Brownsburg-Chatham

45.68342

Data:Countries/Canada

Quebec

Buckingham

45.58563

Data:Countries/Canada

Quebec

Cabano

47.68065

Data:Countries/Canada

Quebec

Cacouna

47.91657

Data:Countries/Canada

Quebec

Candiac

45.38338

Data:Countries/Canada

Quebec

Cantley

45.5668

Data:Countries/Canada

Quebec

Cap-Chat

49.10009

Data:Countries/Canada

Quebec

Cap-Santé

46.67159

Data:Countries/Canada

Quebec

Capitale-Nationale

47.376

Data:Countries/Canada

Quebec

Carignan

45.45008

Data:Countries/Canada

Quebec

Carleton

48.09838

Data:Countries/Canada

Quebec

Carleton-sur-Mer

48.10749

Data:Countries/Canada

Quebec

Centre-du-Québec

46.01985

Data:Countries/Canada

Quebec

Chambly

45.45008

Data:Countries/Canada

Quebec

Chambord

48.43339

Data:Countries/Canada

Quebec

Chandler

48.34935

Data:Countries/Canada

Quebec

Chapais

49.78344

Data:Countries/Canada

Quebec

Charlemagne

45.71678

Data:Countries/Canada

Quebec

Château-Richer

46.96031

Data:Countries/Canada

Quebec

Châteauguay

45.38338



This is a page with an infobox that demonstrates the use of VisualData (latest version) used as a CRUD

Click the button below to edit the article's metadata through a popup or the tab "Edit semantic" among the article's actions.


form is loading...


The popup is rendered using the following code

{{#visualdataform: Book
|title = edit infobox and page
|action = edit
|edit-page = {{FULLPAGENAME}}
|return-page = 
|view = popup
|popup-size = medium
|css-class =
|pagename-formula =
|edit-freetext = true	
|edit-categories = false
|edit-content-model = false
|default-categories = 
|default-content-model = wikitext
|layout-align = top
|popup-help = true 
|submit-button-text =
|layout = tabs
|submit-button-text =
|validate-button-text =
}}

A Pageproperties' form can edit whatever page (through the parameter edit-page, and create new pages with user-defined title or using a pagename formula. It is json/schema compliant[1] and can handle subitems, multiple fields and multiple sub items. It is deeply integrated with the Mediawiki's OOUI library and uses a lot or most of its features. In the latest version can query properties and nested properties, as well as render them using templates and nested templates and does not rely on SemanticMediawiki.


The infobox is rendered through the following code:

{{#visualdataprint: {{FULLPAGENAME}}
|?cover
|?title
|?authors/name
|?authors/email
|schema=Book
|template=Book
|template?authors=Book authors
|format=template
}}


This is a SemanticMediawiki-like parser function that can be used as a shorthand to invoke the more complex {{#visualdataquery }} parser function that can handle multi-page results and provides a basic query language. (more about this on the official page of the extension to be updated soon)

The results are rendered on the page using 2 templates, Template:Book and Template:Book authors. The second is used as a nested template rendered inside the parent template (Template:Book) entitled to render the properties with path authors. Note that the parent template must include a reference to the name of the child template since both values and template's containers are passed as named parameters.


The form's schema(s) (a form can contain an arbitrary number of schemas, and a schema an arbitrary number of items and subitems) can be edited using this Special page or this interface (tab Edit semantic, edit icon on the right and then "Manage schemas")

The related schema created by the UI contains an hidden property "name" that is filled-in with the compounded value of the fields first_name and last_name. Also, the cover file name contains a value-formula, that allows the file to be saved with the article-id as prefix (also for new articles) which is useful to easily upload on the wiki files with similar names.


Have fun with this extension !!


See also

  1. It does not yet support allOf, anyOf, oneOf, and $refs both in the editor and in the viewer