GoodRelations is a standardized vocabulary for product, price, and company data that can (1) be embedded into existing static and dynamic Web pages and that (2) can be processed by other computers. This increases the visibility of your products and services in the latest generation of search engines, recommender systems, and other novel applications.
Martin Hepp
martin.hepp at ebusiness-unibw.org
Tue Jul 20 17:10:27 CEST 2010
Dear all: I recently found out that there is a pitfall when dealing with xsd:data type data in RDF & SPARQL. While GoodRelations itself does not use xsd:date, this may affect product features modeled in domain- specific extensions of GoodRelations (as described in [1]). Assume you define a property foo:modelYear a owl:DatatypeProperty ; rdfs:subPropertyOf gr:datatypProductOrServiceProperty ; rdfs:label "The date of introduction of a car make and model "@en ; rdfs:range xsd:date ; rdfs:domain gr:ProductOrService . If you do now attach this to a car model data:myCar a gr:ProductOrServiceModel ; rdfs:label "1998 Chevrolet Convertible"@en ; foo:modelYear "1998-04-01"^^xsd:date . then querying for a model with modelYear = "1998-04-01" may not return matches, e.g. the following SPARQL query will likely fail: SELECT ?model { ?model a gr:ProductOrServiceModel . ?model rdfs:label ?label . ?label bif:contains "Chevrolet" . ?model foo:modelYear ?date . FILTER(?date = "1998-04-01"^^xsd:date) . } Limit 10 The problem is that xsd:date is internally holding hour information that may also be modified by time-zone differences when the data is being processed by the underlying RDF repository. The following query should work: SELECT ?model { ?model a gr:ProductOrServiceModel . ?model rdfs:label ?label . ?label bif:contains "Chevrolet" . ?model foo:modelYear ?date . FILTER(xsd:dateTime(?date) >= "1998-04-01T00:00:00Z"^^xsd:dateTime && xsd:dateTime(?date) <= "1998-04-01T23:59:59Z"^^xsd:dateTime) . } Limit 10 Source & Acknowledgments: http://www.semanticoverflow.com/questions/947/dbpedia-sparql-endpoint-xsddate-comparison-weirdness Best wishes Martin Hepp [1] http://www.ebusiness-unibw.org/wiki/Own_GoodRelations_Vocabularies -------------------------------------------------------- martin hepp e-business & web science research group universitaet der bundeswehr muenchen e-mail: hepp at ebusiness-unibw.org phone: +49-(0)89-6004-4217 fax: +49-(0)89-6004-4620 www: http://www.unibw.de/ebusiness/ (group) http://www.heppnetz.de/ (personal) skype: mfhepp twitter: mfhepp Check out GoodRelations for E-Commerce on the Web of Linked Data! ================================================================= * Project Main Page: http://purl.org/goodrelations/ * Quickstart Guide for Developers: http://bit.ly/quickstart4gr * Vocabulary Reference: http://purl.org/goodrelations/v1 * Developer's Wiki: http://www.ebusiness-unibw.org/wiki/GoodRelations * Examples: http://bit.ly/cookbook4gr * Presentations: http://bit.ly/grtalks * Videos: http://bit.ly/grvideos