No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:Semantic data queries}} | {{DISPLAYTITLE:Semantic data queries}} | ||
Line 19: | Line 18: | ||
Then, using the pipe-syntax <code>|?</code> we define which property values we want to display (2). | Then, using the pipe-syntax <code>|?</code> we define which property values we want to display (2). | ||
<br /> | <br /> | ||
The default results output is in a table format. The page from which the customer data originates is automatically added as a first column (this can be customized as needed). | The default results output is in a table format. The page from which the customer data originates is automatically added as a first column (this can be customized as needed). | ||
==Adjusting the output format== | ==Adjusting the output format== | ||
The output of the data is very flexible and offers many customizing options. Let's look at some examples. | The output of the data is very flexible and offers many customizing options. Let's look at some examples. | ||
===Table formatting=== | ===Table formatting=== | ||
Line 42: | Line 28: | ||
Output with adjusted table width of 100% (format=broadtable) and with adjusted column labels. The first column also gets a custom label (mainlabel=Customer): | Output with adjusted table width of 100% (format=broadtable) and with adjusted column labels. The first column also gets a custom label (mainlabel=Customer): | ||
Query:<syntaxhighlight lang="text"> | |||
{{#ask: | {{#ask: | ||
[[Category:Customer data]] | [[Category:Customer data]] | ||
|?Has location = Location | |?Has location = Location | ||
|?Has contact person = Contact | |?Has contact person = Contact | ||
|?Has | |?Has first contact= Date of first contact | ||
|mainlabel = Customer | |mainlabel = Customer | ||
|format= broadtable | |format= broadtable | ||
Line 86: | Line 65: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<br />The following query shows all results for the namespace ''Manual'' '''and'' for the namespace ''(Main)'''''and'<nowiki/>'' for the category ''customer data''. All three selection criteria have to be valid for a page to be included in the results. (Note: The namespace (Main) is referenced as empty prefix (<code>:+</code>).<syntaxhighlight lang="text"> | <br />The following query shows all results for the namespace ''Manual'' '''and'' for the namespace ''(Main)'''''and'<nowiki/>'' for the category ''customer data''. All three selection criteria have to be valid for a page to be included in the results. (Note: The namespace (Main) is referenced as empty prefix (<code>:+</code>).<syntaxhighlight lang="text"> | ||
{{#ask:[[Manual:+||:+]] [[Category:Customer data]] | {{#ask:[[Manual:+||:+]] [[Category:Customer data]] | ||
Line 97: | Line 72: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
The following query shows the results from namespace ''Manual'' and from the category ''Customer data''. | The following query shows the results from namespace ''Manual'' and from the category ''Customer data''. | ||
<syntaxhighlight lang="text"> | <syntaxhighlight lang="text"> | ||
Line 110: | Line 80: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<br /> | |||
{{Box Links-en|Topic1=[https://www.semantic-mediawiki.org/wiki/Help:Inline_queries https://www.semantic-mediawiki.org/wiki/Help:Inline_queries] Help page for semantic inline queries}} | {{Box Links-en|Topic1=[https://www.semantic-mediawiki.org/wiki/Help:Inline_queries https://www.semantic-mediawiki.org/wiki/Help:Inline_queries] Help page for semantic inline queries}} | ||
[[en:{{FULLPAGENAME}}]] | [[en:{{FULLPAGENAME}}]] | ||
[[de:Handbuch:Semantic_MediaWiki/Beispiele/Kundendaten/Abfrage]] | [[de:Handbuch:Semantic_MediaWiki/Beispiele/Kundendaten/Abfrage]] |
Latest revision as of 15:47, 15 July 2025
You can query and display the data that you collect in the wiki at at any time on any wiki page.
"Ask" queries
With the parser function "#ask", we can now use the semantic properties and the category association to show the collected data on our wiki pages.
As an example, we list the pages that collect customer data. You can include this "ask" query on any wiki page:
{{#ask:
[[Category:Customer data]] [[Modification date::+]]
|?Has location
|?Has contact person
|?Has First contact
}}
This query first defines via the category Customer data that only pages within this category should be included in the data query (1).
Then, using the pipe-syntax |?
we define which property values we want to display (2).
The default results output is in a table format. The page from which the customer data originates is automatically added as a first column (this can be customized as needed).
Adjusting the output format
The output of the data is very flexible and offers many customizing options. Let's look at some examples.
Table formatting
Output with adjusted table width of 100% (format=broadtable) and with adjusted column labels. The first column also gets a custom label (mainlabel=Customer):
Query:
{{#ask:
[[Category:Customer data]]
|?Has location = Location
|?Has contact person = Contact
|?Has first contact= Date of first contact
|mainlabel = Customer
|format= broadtable
}}
Simple page list
Output of pages that use the template "Customer data" in a list format:
Query:
{{#ask:
[[Category:Customer data]] [[Modification date::+]]
|format= ul
}}
Adjusting the query
In semantic queries, results can be filtered by namespaces, categories and semantic attributes.
Examples
The following query shows all results for the namespace Manual and the category Customer data. The output shows the location of the customers:
{{#ask:[[Manual:+]] [[Category:Customer data]] [[Modification date::+]]
|?Has location = Location
}}
The following query shows all results for the namespace Manual and for the namespace (Main)and' for the category customer data. All three selection criteria have to be valid for a page to be included in the results. (Note: The namespace (Main) is referenced as empty prefix (:+
).
{{#ask:[[Manual:+||:+]] [[Category:Customer data]]
|?Has location = Location
|mainlabel = Customer
}}
The following query shows the results from namespace Manual and from the category Customer data.
{{#ask:[[Category:Customer data]] [[Has location::Regensburg]]
|?Has location = Location
|mainlabel = Customer
}}