root/Explorator/trunk/lib/dataload.rb @ 261

Revision 261, 7.5 KB (checked in by samuraraujo, 10 years ago)
Line 
1require "date"
2require "logger"
3#This module loads the adapters.
4#Each adapter has a connection with a repository.
5#See the ActiveRDF documentation for further references.
6#Author: Samur Araujo
7#Date: 25 jun 2008.
8
9require 'active_rdf' 
10def createdir(dir)
11  Dir.mkdir("db/" + dir) unless File.directory?("db/" + dir)
12end
13#$activerdflog.level = Logger::DEBUG
14#Keep track of all repositories registered in the pool
15
16#dir = File.dirname(File.expand_path(__FILE__))
17dbdir = Dir.pwd +  File::SEPARATOR + 'db'
18
19#ConnectionPool.add_data_source :type => :sparql,:engine => :sesame2, :url => "http://localhost:8087/openrdf-sesame/repositories/TESTE", :results => :sparql_xml
20#ConnectionPool.add_data_source :type => :sesame, :name=>:teste
21#
22
23#adapter =ConnectionPool.add_data_source :type => :sparql,:engine => :sesame2, :url => "http://localhost:8181/org.semanticdesktop.services.rdfrepository/repositories/main", :results => :sparql_xml, :caching =>true
24#adapter.title='NEPOMUK_SPARQL'
25
26sesamedir = Dir.new(dbdir + File::SEPARATOR + 'Sesame' + File::SEPARATOR + "repositories")
27sesamedir.each  do |x| 
28 
29  if x.rindex('.') == nil && x!= ('SYSTEM') 
30   
31    adapter =ConnectionPool.add_data_source :type => :sparql_sesame_api ,  :caching =>true, :repository => x, :dir => sesamedir.path
32    adapter.title=x + '_DEFAULT'   
33  end
34end
35
36#adapter =ConnectionPool.add_data_source :type => :sparql,:engine => :sesame2, :url => "http://localhost:8080/openrdf-sesame/repositories/PRESIDENT", :results => :sparql_xml, :caching =>true
37#adapter.title='PRESIDENT_PARALLAX_DEFAULT'
38#
39#adapter =ConnectionPool.add_data_source :type => :sparql,:engine => :sesame2, :url => "http://localhost:8080/openrdf-sesame/repositories/NOKIA", :results => :sparql_xml, :caching =>true
40#adapter.title='NOKIA_DEFAULT'
41#
42#adapter =ConnectionPool.add_data_source :type => :sparql,:engine => :sesame2, :url => "http://localhost:8080/openrdf-sesame/repositories/MONDIAL", :results => :sparql_xml, :caching =>true
43#adapter.title='MONDIAL_DEFAULT'
44#
45#adapter =ConnectionPool.add_data_source :type => :sparql,:engine => :sesame2, :url => "http://localhost:8080/openrdf-sesame/repositories/CIA", :results => :sparql_xml, :caching =>true
46#adapter.title='CIA_DEFAULT'
47#
48#adapter =ConnectionPool.add_data_source :type => :sparql,:engine => :sesame2, :url => "http://localhost:8080/openrdf-sesame/repositories/METAMODEL", :results => :sparql_xml, :caching =>true
49#adapter.title='METAMODEL_SPARQL'
50#
51#adapter =ConnectionPool.add_data_source :type => :sparql,:engine => :sesame2, :url => "http://localhost:8080/openrdf-sesame/repositories/FACETO", :results => :sparql_xml, :caching =>true
52#adapter.title='FACETO_DEFAULT'
53#adapter =ConnectionPool.add_data_source :type => :sparql,:engine => :sesame2, :url => "http://data.linkedmdb.org/sparql", :results => :sparql_xml, :caching =>true
54#adapter.title='IMDB_SPARQL'
55
56
57#
58#adapter =ConnectionPool.add_data_source :type => :sparql,:engine => :virtuoso, :url => "http://www.w3c.es/Prensa/sparql/", :results => :sparql_xml, :caching =>true
59#adapter.title='REVYU'
60
61
62#adapter =ConnectionPool.add_data_source :type => :sparql,:engine => :sesame2, :url => "http://dbtune.org:2105/sparql/", :results => :sparql_xml
63#adapter.title='BDTune'
64#
65#adapter =ConnectionPool.add_data_source :type => :sparql,:engine => :sesame2, :url => "http://spade.lbl.gov:2020/sparql", :results => :sparql_xml
66#adapter.title='Spade'
67
68#adapter = ConnectionPool.add(:type => :rdflite, :location => 'db/semanticweb/semanticweb.db', :reasoning => false,:keyword => true)
69#adapter.title='SEMANTICWEB'
70#adapter.load('lib/semanticweb.nt')
71#createdir("cia")
72#adapter = ConnectionPool.add( :type => :rdflite, :location => 'db/cia/cia.db', :reasoning => false,:keyword => false)
73#adapter.title='CIA'
74#
75#
76##adapter.load('lib/cia.nt')
77#createdir("terrorist")
78#adapter = ConnectionPool.add(:type => :rdflite, :location => 'db/terrorist/terrorist.db', :reasoning => false,:keyword => true)
79#adapter.title='TERRORIST'
80#
81#
82#createdir("mondial")
83#adapter = ConnectionPool.add(:type => :rdflite, :location => 'db/mondial/mondial.db', :reasoning => false,:keyword => true)
84#adapter.title='MONDIAL'
85#
86##adapter.load('lib/mondial.nt')
87#
88#createdir("portinari")
89#adapter = ConnectionPool.add(:type => :rdflite, :location => 'db/portinari/portinari.db', :reasoning => false,:keyword => true)
90#adapter.title='PORTINARI'
91#
92#
93#adapter = ConnectionPool.add(:type => :rdflite, :location => 'db/rdfexplot.db', :reasoning => false,:keyword => true)
94#adapter.title='DBLP 500MB'
95#
96#createdir("nokia")
97#adapter = ConnectionPool.add(:type => :rdflite, :location => 'db/nokia/nokia.db', :reasoning => false,:keyword => true)
98#adapter.title='Nokia'
99##adapter.load('public/data/nokia.nt')
100#
101#
102#createdir("wn")
103#adapter = ConnectionPool.add(:type => :rdflite, :location => 'db/wn/wn.db', :reasoning => false,:keyword => false)
104#adapter.title='WordNet'
105##adapter.load('public/data/wn.nt.001')
106#
107#createdir("www2008")
108#adapter = ConnectionPool.add(:type => :rdflite, :location => 'db/www2008/www.db', :reasoning => false,:keyword => true)
109#adapter.title='WWW 2008'
110##adapter.load('lib/www2008.nt')
111#
112#createdir("eswc")
113#adapter = ConnectionPool.add(:type => :rdflite, :location => 'db/eswc/eswc.db', :reasoning => false,:keyword => true)
114#adapter.title='ESWC 2008'
115##adapter.load('lib/eswc2008.nt')
116#createdir("explorator")
117#adapter = ConnectionPool.add(:type => :rdflite, :location => 'db/metamodel/metamodel.db', :reasoning => false,:keyword => true)
118#adapter.title='METAMODEL'
119#adapter.load('public/data/metamodel.nt')
120
121#You should insert here a line for each namespace that you want to use in your application.
122#The namespace must be unique. If you have doubt please see the ActiveRDF documentation.
123Namespace.register(:dp1, 'http://sw.nokia.com/DP-1/')
124Namespace.register(:fn1, 'http://sw.nokia.com/FN-1/')
125Namespace.register(:mars, 'http://sw.nokia.com/MARS-3/')
126Namespace.register(:voc1, 'http://sw.nokia.com/VOC-1/')
127Namespace.register(:fntype, 'http://sw.nokia.com/FN-1/Type/')
128Namespace.register(:sesame, 'http://www.openrdf.org/schema/sesame#')
129Namespace.register(:dc, 'http://purl.org/dc/elements/1.1/')
130Namespace.register(:dcterms, 'http://purl.org/dc/terms/')
131Namespace.register(:editor, 'http://sw.nokia.com/Editor-1/')
132Namespace.register(:webarch, 'http://sw.nokia.com/WebArch-1/')
133Namespace.register(:faceto, 'http://www.semanticnavigation.org/2008/faceto#')
134Namespace.register(:explorator, 'http://www.explorator.org/2008/explorator#')
135Namespace.register(:foaf, 'http://xmlns.com/foaf/0.1/')
136Namespace.register(:dbpedia, 'http://dbpedia.org/resource/')
137Namespace.register(:imdb, 'http://www.imdb.org/')
138Namespace.register(:wn, 'http://www.w3.org/2006/03/wn/wn20/schema/')
139
140Namespace.register(:explorator, 'http://www.tecweb.inf.puc-rio.br/ontologies/2008/explorator/01/core#')
141
142Namespace.register(:imdb2, 'http://wwwis.win.tue.nl/~ppartout/Blu-IS/Ontologies/IMDB/')
143
144Namespace.register(:oddlinker, "http://data.linkedmdb.org/resource/oddlinker/")
145Namespace.register(:map, "file:/C:/d2r-server-0.4/mapping.n3#")
146Namespace.register(:db, "http://data.linkedmdb.org/resource/")
147Namespace.register(:skos,"http://www.w3.org/2004/02/skos/core#")
148Namespace.register(:moviedmdb,"http://data.linkedmdb.org/resource/movie/")
149Namespace.register(:omdb,"http://triplify.org/vocabulary/omdb#")
150Namespace.register(:movie,"http://triplify.org/vocabulary/movie#")
151Namespace.register(:mondial,"http://www.semwebtech.org/mondial/10/meta#")
152
153RDFS::Resource.find_all_predicates
154
155# construct the necessary Ruby Modules and Classes to use the Namespace
156ObjectManager.construct_classes
Note: See TracBrowser for help on using the browser.