From: Stefan H. <mai...@ha...> - 2010-04-06 22:48:58
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-15"> </head> <body bgcolor="#ffffff" text="#000000"> <font face="Helvetica, Arial, sans-serif">Hi there,<br> at home I'm using SMW as a personal log for my triathlon training where I can link anything I find about competitions, training etc. For each run/cycling/swimming training I create a page with all relevant information as properties (duration, kilometers, ...) <br> <br> However doing simple statistics, e.g. how many running kilometers in the last week/month/.., is not straightforward with SMW and I desparately searched for a query condition term like [[weekofyear(Date</font><font face="Helvetica, Arial, sans-serif">Property</font><font face="Helvetica, Arial, sans-serif">)::12]] or [[month(DateProperty)::3]] which would allow to select pages within a certain time range without adding additional properties like "weekofyear" and "month". It's a feature well known from SQL and it seems to me that the SPARQL query language has it with the extension functions too.<br> <br> During easter holiday I took a few hours and dug into the SMW code and I came up with an implementation for the storage-independent part in SMW_Description by adding a class SMWFunction and a little parser code in SMW_QueryParser, but I got stuck when it came to SMW_SQLStore2_Queries.php. <br> The first problem was my lack of knowledge about how the SQL query is being constructed :( and the second was that even though I could manage to hook into the processing of the SMW_Description "tree", at the moment it looks to me as if the "right side" of the query condition (the 12 or 3 in the examples above) is build by somehow utilizing the datatype of the queried property - but the first 12 lines in compileAttributeWhere are just "black magic" to me right now...<br> <br> I'd really like to see this functionality and I think with a general approach more applications might come up (e.g. selecting coordinates only by latitude ...)<br> <br> Or maybe its just time to give the triple store connector a try and use SPARQL here :)<br> <br> Good night, Stefan<br> </font> <pre class="moz-signature" cols="72">-- Stefan Harwarth Riezlerstraße 85g 85051 Ingolstadt Fon 0179 53 13 077 Mail <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:st...@ha...">st...@ha...</a> Please consider the environment before printing this email.</pre> </body> </html> |