GoodRelations and Geo / Location Data

From Wiki of the E-Business and Web Science Research Group
Jump to: navigation, search
GoodRelations is a standardized vocabulary for product, price, and company data that can be embedded into existing static and dynamic Web pages.

Project Main Page
Developer's Wiki
GoodRelations Cookbook

This recipe shows how you can attach and query for location data attached to an office or a store using the GoodRelations vocabulary for e-commerce on the Web of Linked Data.


GoodRelations itself does not provide properties for geo / position data. Instead, we recommend using existing vocabularies and attaching them to the respective location.

The most relevant GoodRelations classes for this purpose are

  • gr:BusinessEntity, if you want to attach a position to your main office (the legal residence of your business) and
  • gr:LocationOfSalesOrServiceProvisioning for your stores; this is the most important usage.

There exist three popular vocabularies for attaching geo position data to objects; those are

We recommend using either WGS84 or vcard 2006 properties, but when querying data, you have to expect all three patterns.



Note: As far as I can see from the spec, the WGS84 ontology assumes a range of untyped literals for the geo:lat and geo:long properties.

@prefix geo: <>.

    a    gr:LocationOfSalesOrServiceProvisioning;
    gr:hasOpeningHoursSpecification foo:workdays, foo:saturdays;
       "Best Buy - Woodland, Store 1396"@en;
	 geo:lat "48.0802626";
         geo:long "11.6407428".

vCard 3.0 / 2001 (deprecated)

Note: It is unclear to me whether this pattern is used in the wild; also, while GEO is defined in the original vcard vocabulary, vCard:longitude and vCard:latitude are not defined in the RDF version.

Do not use this pattern for new data.

@prefix vCard: <>.

    a    gr:LocationOfSalesOrServiceProvisioning;
    gr:hasOpeningHoursSpecification foo:workdays, foo:saturdays;
       "Best Buy - Woodland, Store 1396"@en;
            [ ... ];
	vCard:latitude "48.0802626";
	vCard:longitude "11.6407428".

vCard 2006 (as used by Yahoo)

Note 1: The current 2006 spec says the range of latitude and longitude is xsd:double, but in the wild, we mostly find xsd:float.

Note 2: This vocabulary will soon be superseded by the 2009 update of vcard, which may recommend WGS84 for geo position data.

@prefix vcard: <>.

foo:myStore a gr:LocationOfSalesOrServiceProvisioning;
   rdfs:label "Hepp Space Ventures Inc."@en;
   vcard:adr [ ... ];
	vcard:latitude "48.0802626"^^xsd:double;
        vcard:longitude "11.6407428"^^xsd:double.
   vcard:tel "+49-89-6004-0"^^xsd:string.


The following SPARQL query lists the first 50 store locations and their longitude and latitude from a given graph or endpoint, taking into account all of the three patterns described above:

PREFIX geo:   <>
PREFIX vcard: <>
PREFIX vc:    <>

SELECT ?store, ?long, ?lat WHERE
{?store a gr:LocationOfSalesOrServiceProvisioning.

           ?store vcard:geo ?y.
           ?y vcard:latitude ?lat.
           ?y vcard:longitude ?long.
	?store geo:location ?y.
	?y geo:lat ?lat.
           ?y geo:long ?long.
	?store vc:GEO ?y.
	?y vc:latitude ?lat.
	?y vc:longitude ?long.
# The following is a wrong usage of the geo vocabulary, but may be a common pattern on the Web
	?store geo:lat ?lat.
          ?store geo:long ?long.

You can try it against the public Linked Open Commerce dataspace at

Click here for executing the query.

Geospatial Queries with Virtuoso

The OpenLink Virtuoso repository has been augmented by powerful support for spatial queries, e.g. "find all stores that are withing 10 miles of my current position".

See Orri Erling's blogpost at

We will add sample queries shortly.

Resources and References