E-Business + Web Science Research Group

Exchange Rates for the Semantic Web

V1.0, Release 08-11-2012

Author: Alex Stolz

License: Creative Commons Attribution 3.0

Prefix: xch:

Based on:

[back to top]

Structure

[back to top]

SPARQL Example

PREFIX gr: <http://purl.org/goodrelations/v1#>
PREFIX xro: <http://purl.org/xro/ns#>
 
SELECT DISTINCT ?offer, ?name, ?from_rate, ?from_price, ?from_currency, ?to_rate, ?from_price*?to_rate/?from_rate as ?to_price, ?to_currency
WHERE {
  ?offer a gr:Offering .
  ?offer gr:name ?name .
  ?offer gr:hasPriceSpecification ?pspec .
  ?pspec a gr:UnitPriceSpecification .
  ?pspec gr:hasCurrency ?from_currency .
  ?pspec gr:hasCurrencyValue ?from_price .
  ?to_curr xro:hasCode ?to_currency .
  FILTER(contains(?to_currency, "EUR"))
  ?to_curr xro:hasRate ?to_rate .
  ?from_curr xro:hasCode ?from_currency .
  ?from_curr xro:hasRate ?from_rate .
  FILTER(isNumeric(?from_price))
  FILTER(?from_price*?to_rate/?from_rate>=10 && ?from_price*?to_rate/?from_rate<=20)
}
LIMIT 10

[back to top]

Usage

The exchange rates for the Semantic Web service is accessible via http://oanda2rdf.appspot.com/xch. It returns a list of currency objects (e.g. xch:CHF, xch:USD, ...) with a default reference currency set to USD (xch:XRate xro:hasReferenceCurrency xch:USD).
For one who needs to use a reference currency other than the default USD, the service allows dereferencing a URI consisting of the base URI and the currency code attached, e.g. http://oanda2rdf.appspot.com/xch/EUR for EUR as reference currency.

[back to top]

Example URIs