From: Rob V. <rv...@do...> - 2012-11-16 23:35:34
|
Hi Dennis No there is currently no support or APIs for extending the grammar Having had a look at that paper it would seem like most of what they wanted to do can be done purely with ORDER BY especially now that there is a much broader and more powerful set of functions available in SPARQL 1.1 (IF, COALESCE and IN are three very useful functions that spring to mind) so this may be worth exploring as a viable alternative. Keeping within the specification is always preferable IMO. Just as an example their PREFERING clause in section 4 could be rewritten as follows: ORDER BY DESC( IF( ?rating = pt:excellent, 1, 0) ) DESC( IF( ?end <= '16:00' || start >= '18:00', ?start, '00:00') ) For the ?rating type conditions where you may have more complex mappings of values to rankings you could either define an extension function (dotNetRDF and other APIs have support for this) or you could use the VALUES clause in your WHERE clause to assign rankings to constants e.g. WHERE { ?t pt:has-rating ?rating VALUES (?rating ?ratingRank) { ( pt:excellent 5 ) ( pt:good 3 ) ( pt:poor 1 ) } } Then you can just do a ORDER BY DESC(?ratingRank), again this latter approach has the advantage of being within the specification (and was actually the motivation for this feature) Hope this helps, Rob Vesse From: Dennis Ludl <Den...@St...> Reply-To: dotNetRDF User Help and Support <dot...@li...> Date: Thursday, November 15, 2012 5:49 AM To: <dot...@li...> Subject: [dotNetRDF-Support] Leviathan - SPARQL grammar extensions > Hi, > I try to find out, if it's possible to extend SPARQL grammar used in your > Leviathan engine. I want to add an preference modifier to the SPARQL grammar, > like proposed by Siberski et al. (W. Siberski, J. Z. Pan, U. Thaden: Querying > the Semantic Web with Preferences. In Proc. of the 5th Int. Semantic Web > Conf., 2006). > > As far as I know there are no API's for such extensions in dotNetRDF, am I > right with this? > > Thank you, > Dennis > ------------------------------------------------------------------------------ > Monitor your physical, virtual and cloud infrastructure from a single web > console. Get in-depth insight into apps, servers, databases, vmware, SAP, > cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from > $795 for 25 servers or applications! > http://p.sf.net/sfu/zoho_dev2dev_nov__________________________________________ > _____ dotNetRDF-Support mailing list dot...@li... > https://lists.sourceforge.net/lists/listinfo/dotnetrdf-support |