It is now possible to store #ask queries on dedicated wiki pages.

This has been suggested in order to shorten the URLs of RSS feeds and the like 
since these URLs currently must contain the whole query and RSS description. 
But storing queries has more advantages, including "query rights" management 
and potential for future caching (planned for SMW 1.3). This is also a big 
step in SMW's OWL and ontology modelling support (also to be extended in SMW 
1.3).


== Details ==

It works as follows: SMW 1.2 has a new namespace Concept: and each page in 
that namespace can hold exactly one query. Imagine a concept to be like 
a "dynamic category": it always contains the set of pages that are described 
by the query. This is also a reason why we chose "Concept" instead of 
e.g. "Query". An example page is

 http://semanticweb.org/wiki/Concept:Semantic_Web_events_2008

The concept is described by a parser function #concept that provides a normal 
SMW query (first parameter) and an optional text description (second 
parameter). Example from the above page:

{{#concept: [[Category:Event]] [[start date::> Jan 1 2008]] 
            [[start date::< Dec 31 2008]]  |
Events in the year 2008 that have been announced on semanticweb.org. To add 
more events, go to the page "Events" on semanticweb.org.
}}

Concepts do not store further parameters that one may have in #ask (printouts, 
sorting conditions, format, etc.). They really just describe a set of things, 
like a category. This way, concepts can be used in queries just like 
categories. Here are some examples:

{{#ask: [[Concept:Semantic web events 2008]] }}
 just shows the members of the concept

{{#ask: [[Concept:Semantic web events 2008]] [[located in::Germany]] }}
 shows events that belong to the concept and are located in Germany

{{#ask: [[Concept:Semantic Web events 2008]]
 | ?start date=start
 | ?end date=end
 | ?has location city=location
 | ?title=description
 | format=icalendar 
 | limit=500
}}
 shows an iCalendar link to the 2008 events. The title and description of the 
exported calendar is taken from the concept in this case, so the URL does not 
have to contain all the description text.

The last case works similar for RSS: if you use *only* a single concept for an 
RSS feed, and if you do not provide a description or title for the feed, then 
these values will be taken from the concept page (page title and concept 
description). This allows you to have much shorter feed URLs.

Concepts also have the nice property that they make important queries in your 
wiki more explicit. In this way, SMW knows that a certain query is important 
to you and it can optimise answering of those queries (future work ;-). Also, 
SMW can *export* your queries now: click on the "RDF feed" link on a concept 
page to see the machine-readable version of the query. The OWL format that we 
use for export can nicely capture many SMW queries, and OWL tools can 
actually read these descriptions and reuse them externally. So SMW now cannot 
just export your wiki data, but also conceptual information about your topic.

A practical tip: many wikis use templates for #ask queries, e.g. to use one 
query on many pages by making it refer to the current {{PAGENAME}}. Concepts 
in turn describe just one query, so one would need one concept per page. If 
you still want to make use of concepts in this case, you can make query 
templates that check if some Concept page exists (parserfuntion #ifexist), 
and use the direct #ask only if not. An example for this is 
Template:Yearly_calendar on semanticweb.org. It uses the above example 
concept for 2008, but it would insert a full #ask query for 2003 (where no 
concept page exists yet). In this way, we get shorter iCalendar URLs if 
possible, but still can use the template in cases where no Concept was 
created yet. A similar technique would work on sites with many RSS feeds.


Finally, the fact that Concept is a separate namespace allows you to implement 
access control for queries. I will write a separate mail about this.

Cheers,

Markus

-- 
Markus Krötzsch
Semantic MediaWiki    http://semantic-mediawiki.org
http://korrekt.org    [EMAIL PROTECTED]

Attachment: signature.asc
Description: This is a digitally signed message part.

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to