Database Reference
In-Depth Information
Aggregating data from different formats
Being able to aggregate data from many linked data sources is good, but most data isn't
already formatted for the semantic Web. Fortunately, linked data's lexible and dynamic data
model facilitates the integration of data from multiple sources.
For this recipe, we'll combine several previous recipes. We'll load currency data from RDF,
as we did in the Reading RDF data recipe. We'll also scrape the exchange rate data from
X-Rates ( http://www.x-rates.com ) to get information out of a table, just as we did in the
Scraping data from tables in web pages recipe. Finally, we'll dump everything into a triple
store and pull it back out, as we did in the last recipe.
Getting ready
First, make sure your Leiningen project.clj ile has the right dependencies:
(defproject getting-data "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.6.0"]
[incanter "1.5.5"]
[enlive "1.1.5"]
[edu.ucdenver.ccp/kr-sesame-core "1.4.17"]
[org.clojure/tools.logging "0.3.0"]
[org.slf4j/slf4j-simple "1.7.7"]
[clj-time "0.7.0"]])
We need to declare that we'll use these libraries in our script or REPL:
(require '(clojure.java [io :as io]))
(require '(clojure [xml :as xml]
[string :as string]
[zip :as zip]))
(require '(net.cgrand [enlive-html :as html])
(use 'incanter.core
'clj-time.coerce
'[clj-time.format :only (formatter formatters parse unparse)]
'edu.ucdenver.ccp.kr.kb
'edu.ucdenver.ccp.kr.rdf
'edu.ucdenver.ccp.kr.sparql
'edu.ucdenver.ccp.kr.sesame.kb)
(import [java.io File]
[java.net URL URLEncoder])
Finally, make sure that you have the ile, data/currencies.ttl , which we've been using
since Reading RDF data .
 
Search WWH ::




Custom Search