Cookie consent settingsAccept all
  • Skip to header bar
  • Skip to main navigation
  • Skip to page tools
  • Skip to work area
  • New process
  • Overview
    • Files
    • Processes
    • Ratings
    • Recommendations
    • WikiExplorer
    • Workflows
  • Login
Book navigation as tree structure
Main navigation
Getting started with Semantic MediaWiki
PreviousNext
Edit book
Main navigation contains tabs, main links and MediaWiki sidebar
To book navigation
Entrypoints
  • Main Page
  • Pages
  • Books
  • Blogs
  • Recent changes
Quick Links
  • All topics
  • Video-Tutorials
  • Templates download
Documentation
  • Security Advisories
  • Installation
  • Releases
  • Software catalog
  • Trust & Safety
Books
  • User manual
  • Admin manual
  • Semantic MediaWiki basics
Participate
  • BlueSpice community
You are viewing an old version of this page. Return to the latest version.
This is the version of 20 December 2021, 09:32 by Redaktion
PreviousNext
  • Manual
  • Semantic MediaWiki
    • Examples
      • Customer data
        • Queries
        Last edited 3 years ago
        by Redaktion

        4 Query the data

        • English
        • Deutsch
        Revision as of 09:32, 20 December 2021 by Redaktion (talk | contribs) (1 revision imported)
        (diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


        You can query and display the data that you collect in the wiki at at any time on any wiki page.

        Contents

        • 1 "Ask" queries
        • 2 Adjusting the output format
          • 2.1 Table formatting
          • 2.2 Simple page list
        • 3 Adjusting the query
          • 3.1 Examples
        • 4 Related info

        "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]]
         |?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).

        Simple "ask" query
        Simple "ask" query


        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]]
         |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]]
        |?Has location = Location
        }}
        

        Result:


        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
        }}
        

        Result:

        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
        }}

        Result:


        Related info

        • https://www.semantic-mediawiki.org/wiki/Help:Inline_queries Help page for semantic inline queries




        PDF exclude - start

        To submit feedback about this documentation, visit our community forum.

        PDF exclude - end
        Retrieved from "https://en.wiki.bluespice.com/w/index.php?title=Manual:Semantic_MediaWiki/Examples/Customer_data/Queries&oldid=820"
        • Pages with syntax highlighting errors
        Edit
        Page actions and tools navigaiton contains tabs, toolbox and actions
        Actions
        • Refresh
        • Copy URL
        • E-Mail
        • QR code
        Details
        • View history
        • Page information
        • Browse properties
        • ... all actions
        • Privacy policy
        • Terms of service
        • Disclaimer
        • Imprint
        • Accessibility
        • About
        • Analysis service
        • Edit preview settings
        • Powered by MediaWiki
        • Powered by BlueSpice
        • Powered by Semantic MediaWiki
        • Creative Commons License