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.
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
.
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"]
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 dslThere 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 you can access are all those tagged inside the wiki page like @date
and some special attributes:
name
the name of the topiccategory
the categorylabel
id
the unique id of the topictags
- comma separated list of tagsurl
the relative url of this topiccontent
the actual original content of the topicAlso the contents of the sections of the page are available as attributes.
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"
}
]
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
You need to log in to post a comment!