WikiPath Pub Share

WikiPath is one of the "research" aspects of this site. The idea is to browse wiki topics and their contents/properties with XPATH like expressions. See this blog: Wiki Domain Models and Racer Kids for the big idea.

Wiki categories and attributes

Every wiki page has a category (such as Race, Topic or Venue), which you can think of as the tag name in XPath and also attributes, such as name which you can get to with @name.

REST API

You can use XP starting from a topic in a very simple REST like manner:

The response will be a JSON array:

[ "", "May 27, 2012"]

Wiki content

Inside a wiki topic, you can use this notation {{xp:expression}} or {{xpl:expression}} to include the result of the expression. The second version is for a list of elements.

Examples:

{{xp:root(Calendar:OO_XC_2013)/Race/@date}} ?

{{xpl:root(Calendar:OO_XC_2013)/Race/@date}}

    and

    {{xp:root(Calendar:OO_XC_2013)/Race/Venue}} ?

    {{xpl:root(Calendar:OO_XC_2013)/Race/Venue}}

      Here's some examples:

      • {{xpl:root(Blog:Cool_Scala)/Post[tags ~= '.*dsl.*']}} - all scala posts tagged dsl

      The "all" root

      There is a special root to browse all pages, please use it carefully:

      {{xpl:root(*)/Venue}} - all venues

      or as a REST API:

      wiki/*/xp/Venue/@name

      The attributes

      The attributes you can access are all those tagged inside the wiki page like @date and some special attributes:

      • name the name of the topic
      • category the category
      • label
      • id the unique id of the topic
      • tags - comma separated list of tags
      • url the relative url of this topic
      • content the actual original content of the topic

      Also the contents of the sections of the page are available as attributes.

      Custom JSON API

      As an extension to XPATH, you can combine a few attributes in the same response, for instance:

      This will return a JSON array:

      [
       {
        "date":"",
        "label":"OO XC Colborne, {{by Northumberland Trail Riders}}, {{date May 20, 2012}}",
        "url":"/wiki/Race:OO_XC_Colborne,_by_Northumberland_Trail_Riders_,_date_May_20,_2012"
       },
       {
        "date":"May 27, 2012",
        "label":"OO XC Mansfield, {{by HORRA}}, {{date May 27, 2012}}",
        "url":"/wiki/Race:OO_XC_Mansfield,_by_HORRA_,_date_May_27,_2012"
       }
      ]
      

      More examples

      Escaping the URL to query an expression - for instance all blog posts tagged with carving:

      http://www.effectiveskiing.com/wiki/carving-blog/xp/Post%5Btags~%3D%27.carving.%27%5D


      Was this useful?    

      By: Razie | 2013-04-10 .. 2022-10-22 | Tags: admin


      Viewed 2802 times ( | History | Print ) this page.

      You need to log in to post a comment!