easy_data 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +7 -0
- data/Rakefile +4 -0
- data/easy_data.gemspec +4 -1
- data/lib/controllers/easy_datas_controller.rb +122 -21
- data/lib/data_models/data_models.rb +25 -19
- data/lib/data_models/model_rdf.rb +156 -0
- data/lib/data_models/namespaces/cc.rb +36 -0
- data/lib/data_models/namespaces/cert.rb +33 -0
- data/lib/data_models/namespaces/dc.rb +87 -0
- data/lib/data_models/namespaces/dc11.rb +47 -0
- data/lib/data_models/namespaces/doap.rb +68 -0
- data/lib/data_models/namespaces/exif.rb +192 -0
- data/lib/data_models/namespaces/foaf.rb +93 -0
- data/lib/data_models/namespaces/geo.rb +35 -0
- data/lib/data_models/namespaces/http.rb +50 -0
- data/lib/data_models/namespaces/owl.rb +83 -0
- data/lib/data_models/namespaces/rdfs.rb +41 -0
- data/lib/data_models/namespaces/rsa.rb +35 -0
- data/lib/data_models/namespaces/rss.rb +38 -0
- data/lib/data_models/namespaces/sioc.rb +110 -0
- data/lib/data_models/namespaces/skos.rb +61 -0
- data/lib/data_models/namespaces/wot.rb +45 -0
- data/lib/data_models/namespaces/xhtml.rb +32 -0
- data/lib/data_models/namespaces/xsd.rb +77 -0
- data/lib/data_models/namespaces.rb +28 -0
- data/lib/data_models/parser_rdf.rb +22 -0
- data/lib/easy_data/tasks.rb +86 -0
- data/lib/easy_data/templates/easy_datas/_list_properties.html.erb +24 -0
- data/lib/easy_data/templates/easy_datas/_list_properties_edit.html.erb +34 -0
- data/lib/easy_data/templates/easy_datas/_model_attributes.html.erb +27 -0
- data/lib/easy_data/templates/easy_datas/_model_attributes_edit.html.erb +13 -0
- data/lib/easy_data/templates/easy_datas/custom_rdf.html.erb +23 -0
- data/lib/easy_data/templates/easy_datas/show.html.erb +1 -0
- data/lib/easy_data/templates/easy_datas/show.xml.builder +16 -0
- data/lib/easy_data/templates/layouts/easy_data_layout.html.erb +15 -0
- data/lib/easy_data/templates/rdf/request.xml.builder +1 -0
- data/lib/easy_data/templates/rdf/show.builder +1 -0
- data/lib/easy_data/templates/stylesheets/.easy_data_style.css.swp +0 -0
- data/lib/easy_data/templates/stylesheets/easy_data_style.css +10 -0
- data/lib/easy_data/version.rb +1 -1
- data/lib/easy_data.rb +51 -2
- data/lib/routes.rb +38 -6
- data/lib/tasks/.rakes.rb.swp +0 -0
- data/lib/tasks/testing_installation.rb +2 -2
- metadata +72 -6
data/README
CHANGED
@@ -12,6 +12,13 @@ In config/routes.rb at the end of routes declarations include:
|
|
12
12
|
|
13
13
|
EasyDataRouting.routes(map)
|
14
14
|
|
15
|
+
After, in [RAILS_HOME]/Rakefile copy this line:
|
16
|
+
|
17
|
+
require "easy_data/tasks"
|
18
|
+
|
19
|
+
At the end, execute the next task:
|
20
|
+
|
21
|
+
rake easy_data:install RAILS_ENV=development
|
15
22
|
|
16
23
|
Commandas and Query
|
17
24
|
======================
|
data/Rakefile
CHANGED
data/easy_data.gemspec
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
|
3
5
|
require "easy_data/version"
|
4
6
|
|
5
7
|
Gem::Specification.new do |s|
|
@@ -21,7 +23,8 @@ Gem::Specification.new do |s|
|
|
21
23
|
#gem dependencies:
|
22
24
|
#All is not necesary, only is for study his methods
|
23
25
|
|
24
|
-
|
26
|
+
s.add_dependency(%q<hpricot>, [">= 0.8.4"])
|
27
|
+
s.add_dependency(%q<haml>, [">= 3.0.0"])
|
25
28
|
#s.add_dependency(%q<rdf>, [">= 0"])
|
26
29
|
#s.add_dependency(%q<haml>, [">= 3.0.0"])
|
27
30
|
#s.add_dependency(%q<nokogiri>, [">= 1.3.3"])
|
@@ -1,40 +1,141 @@
|
|
1
1
|
require "action_controller"
|
2
|
-
|
2
|
+
require "action_view"
|
3
|
+
require "builder"
|
3
4
|
|
4
5
|
class EasyDatasController < ActionController::Base
|
6
|
+
|
7
|
+
layout 'easy_data_layout'
|
5
8
|
|
6
9
|
def show
|
7
|
-
|
10
|
+
|
11
|
+
# begin
|
8
12
|
model = eval params[:model].to_s
|
9
|
-
|
10
|
-
|
11
|
-
@request = model.find params[:id]
|
12
|
-
else
|
13
|
-
@request={}
|
14
|
-
relations = {}
|
15
|
-
@request["model"] = params[:model].to_s
|
16
|
-
@request["attributes"] = model.columns.map{|att| att.name}.join(", ")
|
17
|
-
|
18
|
-
model.reflections.each do |relation,values|
|
19
|
-
relations[relation] = {"model" => values.class_name,"type" => values.macro.to_s}
|
20
|
-
end
|
21
|
-
@request["relations"] = relations
|
13
|
+
conditions = parser_params(params[:params]||nil)
|
14
|
+
rdf = ModelRdf.new
|
22
15
|
|
16
|
+
unless conditions.empty?
|
17
|
+
@reply = model.find :all, :conditions => conditions
|
18
|
+
else
|
19
|
+
@reply = model.find :all
|
23
20
|
end
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
@host="http://"+request.env["HTTP_HOST"]
|
22
|
+
|
23
|
+
@rdf_model = rdf.get_model_rdf(@reply,params[:model],"http://"+request.env["HTTP_HOST"])
|
24
|
+
|
25
|
+
@xml = Builder::XmlMarkup.new
|
26
|
+
respond_to do |format|
|
27
|
+
format.html
|
28
|
+
format.xml # render :template => "/rdf/request.xml.builder"
|
29
|
+
end
|
30
|
+
#render :file => "/rdf/request",:content_type => "application/xml",:locals => {:rdf_model => @rdf_model}
|
31
|
+
# rescue
|
32
|
+
# raise ActionController::RoutingError.new('Not Found')
|
33
|
+
# end
|
34
|
+
|
29
35
|
end
|
30
36
|
|
31
37
|
def describe_api
|
32
38
|
models = DataModels.load_models
|
33
39
|
list = {}
|
34
40
|
models.each do |mod|
|
35
|
-
list[mod] = "
|
41
|
+
list[mod.gsub("::","_")] = "#{mod.gsub("::","_")}"
|
36
42
|
end
|
37
43
|
|
38
44
|
render :xml => list
|
39
45
|
end
|
46
|
+
|
47
|
+
def custom_rdf
|
48
|
+
@models = DataModels.load_models
|
49
|
+
end
|
50
|
+
|
51
|
+
def model_attributes
|
52
|
+
|
53
|
+
rdf = ModelRdf.new
|
54
|
+
|
55
|
+
@model_attributes = rdf.get_attributes_model(params[:model])
|
56
|
+
@model = params[:model]
|
57
|
+
|
58
|
+
render :partial => "model_attributes",:layout => nil
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
def model_attributes_edit
|
63
|
+
|
64
|
+
rdf = ModelRdf.new
|
65
|
+
|
66
|
+
@model_attributes = rdf.get_attributes_model(params[:model])
|
67
|
+
@model = params[:model]
|
68
|
+
@namespaces = EasyData::RDF::Namespaces.list_form
|
69
|
+
|
70
|
+
render :partial => "model_attributes_edit",:layout => nil
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
def load_properties
|
75
|
+
|
76
|
+
unless params[:id] == ""
|
77
|
+
namespace = "EasyData::RDF::#{params[:id].upcase}"
|
78
|
+
|
79
|
+
rdf = ModelRdf.new
|
80
|
+
|
81
|
+
@namespace = params[:id]
|
82
|
+
@model_attributes = rdf.get_attributes_model(params[:model])
|
83
|
+
|
84
|
+
properties = (eval namespace).properties_form
|
85
|
+
|
86
|
+
render :inline => "<span>Property:</span><%= select type+'_property',attribute,properties,{:prompt => 'Select a property...'} -%><span class='rdf_info'>(Current value: <%= current_value%>)</span>",
|
87
|
+
:locals => {:properties => properties,
|
88
|
+
:type => params[:type],
|
89
|
+
:attribute => params[:attribute],
|
90
|
+
:current_value => @model_attributes[params[:type]][params[:attribute]][:property]}
|
91
|
+
else
|
92
|
+
render :inline => ""
|
93
|
+
end
|
94
|
+
end
|
95
|
+
def custom_attributes
|
96
|
+
|
97
|
+
rdf = ModelRdf.new
|
98
|
+
@model = params[:model]
|
99
|
+
|
100
|
+
params["rdf_type_attributes"].each do |att,value|
|
101
|
+
if params["attributes_property"][att] != "" && value != ""
|
102
|
+
rdf.update_attributes_model(params[:model],att,'namespace',value)
|
103
|
+
rdf.update_attributes_model(params[:model],att,'property',params["attributes_property"][att])
|
104
|
+
rdf.update_attributes_model(params[:model],att,'privacy',rdf.privacy(params[:privacy][att].to_i))
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
params["rdf_type_associations"].each do |assoc,value|
|
109
|
+
if value != "" && params["associations_property"][assoc] != ""
|
110
|
+
rdf.update_associations_model(params[:model],assoc,'namespace',value)
|
111
|
+
rdf.update_associations_model(params[:model],assoc,'property',params["associations_property"][assoc])
|
112
|
+
rdf.update_associations_model(params[:model],assoc,'privacy',rdf.privacy(params[:privacy][assoc].to_i))
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
rdf.save
|
117
|
+
|
118
|
+
@model_attributes = rdf.get_attributes_model(@model)
|
119
|
+
|
120
|
+
render :partial => "model_attributes",:layout => nil
|
121
|
+
end
|
122
|
+
|
123
|
+
private
|
124
|
+
|
125
|
+
def parser_params (params = nil)
|
126
|
+
|
127
|
+
conditions = {}
|
128
|
+
|
129
|
+
if params.nil? || params == 'ALL'
|
130
|
+
return conditions
|
131
|
+
else
|
132
|
+
params = params.split("$")
|
133
|
+
params.each do |p|
|
134
|
+
p = p.split(':')
|
135
|
+
conditions[p[0].downcase.to_sym] = p[1]
|
136
|
+
end
|
137
|
+
return conditions
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
40
141
|
end
|
@@ -1,33 +1,39 @@
|
|
1
1
|
module DataModels
|
2
2
|
|
3
3
|
def self.load_models
|
4
|
-
|
5
4
|
models = []
|
6
|
-
|
7
|
-
#To test executable /bin/linked_data
|
8
|
-
#Dir["/home/jnillo/Documentos/Proyectos/redmine/app/models/**/*.rb"].each do |file|
|
9
|
-
# models << file.gsub('/home/jnillo/Documentos/Proyectos/redmine/app/models/',"").gsub('.rb','').gsub(":","")
|
10
|
-
#end
|
11
5
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
6
|
+
Dir["#{RAILS_ROOT}/app/models/**/*.rb"].each do |file|
|
7
|
+
models << file.gsub(RAILS_ROOT+'/app/models/',"").gsub('.rb','').classify
|
8
|
+
end
|
9
|
+
|
17
10
|
models
|
18
|
-
|
19
11
|
end
|
20
12
|
|
21
|
-
def self.model_attributes(model)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
13
|
+
def self.model_attributes(model)
|
14
|
+
model.columns.map{|att| att.name}.join(", ")
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.model_relations(model)
|
18
|
+
|
19
|
+
relations = {}
|
20
|
+
|
21
|
+
model.reflections.each do |relation,values|
|
22
|
+
relations[relation] = {"model" => values.class_name,"type" => values.macro.to_s}
|
23
|
+
end
|
24
|
+
|
25
|
+
relations
|
27
26
|
end
|
28
27
|
|
29
28
|
def self.build_models_yaml_file
|
29
|
+
self.models
|
30
|
+
end
|
30
31
|
|
31
|
-
|
32
|
+
def self.get_model_data(model)
|
33
|
+
begin
|
34
|
+
eval model
|
35
|
+
rescue
|
36
|
+
eval model.pluralize
|
37
|
+
end
|
32
38
|
end
|
33
39
|
end
|
@@ -0,0 +1,156 @@
|
|
1
|
+
require "yaml"
|
2
|
+
|
3
|
+
class ModelRdf
|
4
|
+
|
5
|
+
#######################################################################
|
6
|
+
# Attributes declarations
|
7
|
+
#######################################################################
|
8
|
+
@@privacy = ["Hidden","Public","Authenticated"]
|
9
|
+
|
10
|
+
attr_accessor :model_rdf
|
11
|
+
|
12
|
+
|
13
|
+
#######################################################################
|
14
|
+
# Query methods
|
15
|
+
#######################################################################
|
16
|
+
|
17
|
+
#Read the document of attributes relations with rdf properties
|
18
|
+
def initialize
|
19
|
+
@model_rdf = YAML::load(File.open("#{RAILS_ROOT}/config/easy_data/rdf_info.yaml"))
|
20
|
+
end
|
21
|
+
|
22
|
+
# Return datas storeds in the configuration's yaml file
|
23
|
+
def get_models
|
24
|
+
self.model_rdf
|
25
|
+
end
|
26
|
+
|
27
|
+
#Return attributes of model stored in the configuration yaml file
|
28
|
+
def get_attributes_model(model)
|
29
|
+
self.model_rdf[model]
|
30
|
+
end
|
31
|
+
|
32
|
+
# update attributes with rdf properties.
|
33
|
+
def update_attributes_model(model,attribute,param,value)
|
34
|
+
self.model_rdf[model]['attributes'][attribute][param.to_sym] = value
|
35
|
+
end
|
36
|
+
|
37
|
+
def update_associations_model(model,association,param,value)
|
38
|
+
self.model_rdf[model]['associations'][association][param.to_sym] = value
|
39
|
+
end
|
40
|
+
|
41
|
+
# Return privacy of a attribute
|
42
|
+
def privacy(index)
|
43
|
+
@@privacy[index]
|
44
|
+
end
|
45
|
+
|
46
|
+
# Save changes in rdf_info.yaml (configuration's yaml file)
|
47
|
+
def save
|
48
|
+
file = File.open("#{RAILS_ROOT}/config/easy_data/rdf_info.yaml",'w')
|
49
|
+
file.puts YAML::dump(self.model_rdf)
|
50
|
+
file.close
|
51
|
+
end
|
52
|
+
|
53
|
+
#######################################################################
|
54
|
+
# Building RDF
|
55
|
+
#######################################################################
|
56
|
+
|
57
|
+
def get_model_rdf(query,model,host)
|
58
|
+
request = {:body => "",:header => {"xmlns:rdf"=>"http://www.w3.org/1999/02/22-rdf-syntax-ns#"}}
|
59
|
+
elements = {}
|
60
|
+
models = []
|
61
|
+
query.each do |element|
|
62
|
+
elements[element.id] = {'description' => "#{host}/#{element.class.to_s}/#id:#{element.id}",
|
63
|
+
'attributes' => get_properties_tag(element),
|
64
|
+
'associations' => get_associations_tag(element)
|
65
|
+
}
|
66
|
+
|
67
|
+
models << element.class.to_s
|
68
|
+
end
|
69
|
+
attributes = {}
|
70
|
+
request[:body] = elements
|
71
|
+
models.each do |mod|
|
72
|
+
attributes = get_attributes_model(mod) || get_attributes_model((eval mod).base_class.to_s)
|
73
|
+
request[:header].merge!(get_header(attributes))
|
74
|
+
end
|
75
|
+
request
|
76
|
+
#Generating of rdf variable
|
77
|
+
end
|
78
|
+
|
79
|
+
def get_header(attributes)
|
80
|
+
headers = {}
|
81
|
+
|
82
|
+
(attributes["attributes"].merge(attributes["associations"])).each do |att,properties|
|
83
|
+
if properties != "no publication" && properties[:namespace] != 'not defined'
|
84
|
+
headers["xmlns:#{properties[:namespace]}"] = (eval "EasyData::RDF::#{properties[:namespace].upcase}.get_uri") #EasyData.get_uri_namespace(properties[:namespace])
|
85
|
+
end
|
86
|
+
end
|
87
|
+
headers
|
88
|
+
end
|
89
|
+
|
90
|
+
def get_properties_tag(element)
|
91
|
+
|
92
|
+
attributes = get_attributes_model(element.class.to_s)
|
93
|
+
|
94
|
+
# If element's class is a polimorphic class, we used base class.
|
95
|
+
if attributes.nil?
|
96
|
+
attributes = get_attributes_model(element.class.base_class.to_s)
|
97
|
+
end
|
98
|
+
|
99
|
+
properties = {}
|
100
|
+
if element.attributes.respond_to? :each
|
101
|
+
element.attributes.each do |att|
|
102
|
+
#conditions to methods to check if can be show
|
103
|
+
if can_see?(attributes["attributes"][att.first][:privacy]) && exist_info_att(attributes["attributes"][att.first],att.second)
|
104
|
+
properties["#{attributes['attributes'][att.first][:namespace]}:#{attributes["attributes"][att.first][:property]}"] = att.second
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
properties
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
def get_associations_tag(element)
|
114
|
+
|
115
|
+
associations = get_attributes_model(element.class.to_s)
|
116
|
+
|
117
|
+
if associations.nil?
|
118
|
+
associations = get_attributes_model(element.class.base_class.to_s)
|
119
|
+
end
|
120
|
+
properties = {}
|
121
|
+
element.class.reflections.each do |ref,value|
|
122
|
+
rel = eval "element.#{ref}"
|
123
|
+
|
124
|
+
if exist_info_assoc(rel.to_a,associations["associations"][ref.to_s]) && can_see?(associations["associations"][ref.to_s][:privacy]) && !rel.empty?
|
125
|
+
|
126
|
+
properties.merge!({"#{associations['associations'][ref.to_s][:namespace]}:#{associations['associations'][ref.to_s][:property]}" => {:model => rel.first.class ,
|
127
|
+
:id => rel.collect{|obj| obj.id}}
|
128
|
+
})
|
129
|
+
end
|
130
|
+
end
|
131
|
+
properties
|
132
|
+
end
|
133
|
+
|
134
|
+
|
135
|
+
private
|
136
|
+
########################################################################
|
137
|
+
## FUNCTIONS FOR CHECK IF SHOW oR NoT THE CURRENT ITEM ##
|
138
|
+
########################################################################
|
139
|
+
|
140
|
+
def can_see?(privacy)
|
141
|
+
privacy=="Public" || (privacy=="Private" && !@current_user.nil?)
|
142
|
+
end
|
143
|
+
|
144
|
+
def exist_info_att(attributes,value)
|
145
|
+
attributes[:namespace] != "not defined" &&
|
146
|
+
attributes[:property] !="not defined" &&
|
147
|
+
!value.nil?
|
148
|
+
end
|
149
|
+
|
150
|
+
def exist_info_assoc(rels,rdf_info)
|
151
|
+
!rels.nil? && !rels.empty? &&
|
152
|
+
rdf_info[:namespace] != "not defined" &&
|
153
|
+
rdf_info[:property] != "not defined"
|
154
|
+
|
155
|
+
end
|
156
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module EasyData
|
2
|
+
module RDF
|
3
|
+
class CC < Namespaces
|
4
|
+
@@uri = "xmlns:cc=http://creativecommons.org/ns#"
|
5
|
+
@@properties= {"attributionName" => "<cc:attributionName>%value%</cc:attributionName>",
|
6
|
+
"attributionURL" => "",
|
7
|
+
"deprecatedOn" => "",
|
8
|
+
"jurisdiction" => "",
|
9
|
+
"legalcode" => "",
|
10
|
+
"license" => "",
|
11
|
+
"morePermissions" => "",
|
12
|
+
"permits" => "",
|
13
|
+
"prohibits" => "",
|
14
|
+
"requires" => ""
|
15
|
+
}
|
16
|
+
|
17
|
+
# Return Namespace URI
|
18
|
+
def self.get_uri
|
19
|
+
@@uri
|
20
|
+
end
|
21
|
+
|
22
|
+
#Return a list of Namespace's properties
|
23
|
+
def self.properties
|
24
|
+
@@properties.keys
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.properties_form
|
28
|
+
list = {}
|
29
|
+
@@properties.keys.each do |property|
|
30
|
+
list[property] = property
|
31
|
+
end
|
32
|
+
list
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module EasyData
|
2
|
+
module RDF
|
3
|
+
class CERT < Namespaces
|
4
|
+
@@uri = "http://www.w3.org/ns/auth/cert#"
|
5
|
+
@@properties= {"decimal" => "",
|
6
|
+
"hex" => "",
|
7
|
+
"identity" => "",
|
8
|
+
"public_key" => "",
|
9
|
+
}
|
10
|
+
|
11
|
+
# Return Namespace URI
|
12
|
+
def self.get_uri
|
13
|
+
@@uri
|
14
|
+
end
|
15
|
+
# Return tag to rdf doc
|
16
|
+
def self.to_s(property,uri,value)
|
17
|
+
@@properties[property].gsub("%uri%",uri).gsub('%value%',value)
|
18
|
+
end
|
19
|
+
|
20
|
+
#Return a list of Namespace's properties
|
21
|
+
def self.properties
|
22
|
+
@@properties.keys
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.properties_form
|
26
|
+
list = {}
|
27
|
+
@@properties.keys.each do |property|
|
28
|
+
list[property] = property
|
29
|
+
end
|
30
|
+
list
|
31
|
+
end end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
module EasyData
|
2
|
+
module RDF
|
3
|
+
class DC < Namespaces
|
4
|
+
@@uri = "http://purl.org/dc/elements/1.1/"
|
5
|
+
|
6
|
+
@@properties = {"abstract" => "",
|
7
|
+
"accessRights" => "",
|
8
|
+
"accrualMethod" => "",
|
9
|
+
"accrualPeriodicity" => "",
|
10
|
+
"accrualPolicy" => "",
|
11
|
+
"alternative" => "",
|
12
|
+
"audience" => "",
|
13
|
+
"available" => "",
|
14
|
+
"bibliographicCitation" => "",
|
15
|
+
"conformsTo" => "",
|
16
|
+
"contributor" => "",
|
17
|
+
"coverage" => "",
|
18
|
+
"created" => "",
|
19
|
+
"creator" => "",
|
20
|
+
"date" => "",
|
21
|
+
"dateAccepted" => "",
|
22
|
+
"dateCopyrighted" => "",
|
23
|
+
"dateSubmitted" => "",
|
24
|
+
"description" => "",
|
25
|
+
"educationLevel" => "",
|
26
|
+
"extent" => "",
|
27
|
+
"format" => "",
|
28
|
+
"hasFormat" => "",
|
29
|
+
"hasPart" => "",
|
30
|
+
"hasVersion" => "",
|
31
|
+
"identifier" => "",
|
32
|
+
"instructionalMethod" => "",
|
33
|
+
"isFormatOf" => "",
|
34
|
+
"isPartOf" => "",
|
35
|
+
"isReferencedBy" => "",
|
36
|
+
"isReplacedBy" => "",
|
37
|
+
"isRequiredBy" => "",
|
38
|
+
"isVersionOf" => "",
|
39
|
+
"issued" => "",
|
40
|
+
"language" => "",
|
41
|
+
"license" => "",
|
42
|
+
"mediator" => "",
|
43
|
+
"medium" => "",
|
44
|
+
"modified" => "",
|
45
|
+
"provenance" => "",
|
46
|
+
"publisher" => "",
|
47
|
+
"references" => "",
|
48
|
+
"relation" => "",
|
49
|
+
"replaces" => "",
|
50
|
+
"requires" => "",
|
51
|
+
"rights" => "",
|
52
|
+
"rightsHolder" => "",
|
53
|
+
"source" => "",
|
54
|
+
"spatial" => "",
|
55
|
+
"subject" => "",
|
56
|
+
"tableOfContents" => "",
|
57
|
+
"temporal" => "",
|
58
|
+
"title" => "",
|
59
|
+
"type" => "",
|
60
|
+
"valid" => ""
|
61
|
+
}
|
62
|
+
|
63
|
+
# Return Namespace URI
|
64
|
+
def self.get_uri
|
65
|
+
@@uri
|
66
|
+
end
|
67
|
+
|
68
|
+
# Return tag to rdf doc
|
69
|
+
def self.to_s(property,uri,value)
|
70
|
+
@@properties[property].gsub("%uri%",uri).gsub('%value%',value)
|
71
|
+
end
|
72
|
+
|
73
|
+
#Return a list of Namespace's properties
|
74
|
+
def self.properties
|
75
|
+
@@properties.keys
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.properties_form
|
79
|
+
list = {}
|
80
|
+
@@properties.keys.each do |property|
|
81
|
+
list[property] = property
|
82
|
+
end
|
83
|
+
list
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module EasyData
|
2
|
+
module RDF
|
3
|
+
class DC11 < Namespaces
|
4
|
+
@@uri = "http://purl.org/dc/elements/1.1/"
|
5
|
+
@@properties= {"contributor" => "",
|
6
|
+
"coverage" => "",
|
7
|
+
"creator" => "",
|
8
|
+
"date" => "",
|
9
|
+
"description" => "",
|
10
|
+
"format" => "",
|
11
|
+
"identifier" => "",
|
12
|
+
"language" => "",
|
13
|
+
"publisher" => "",
|
14
|
+
"relation" => "",
|
15
|
+
"rights" => "",
|
16
|
+
"source" => "",
|
17
|
+
"subject" => "",
|
18
|
+
"title" => "",
|
19
|
+
"type" => "",
|
20
|
+
}
|
21
|
+
|
22
|
+
# Return Namespace URI
|
23
|
+
def self.get_uri
|
24
|
+
@@uri
|
25
|
+
# "http://purl.org/dc/elements/1.1/"
|
26
|
+
end
|
27
|
+
|
28
|
+
# Return tag to rdf doc
|
29
|
+
def self.to_s(property,uri,value)
|
30
|
+
@@properties[property].gsub("%uri%",uri).gsub('%value%',value)
|
31
|
+
end
|
32
|
+
|
33
|
+
#Return a list of Namespace's properties
|
34
|
+
def self.properties
|
35
|
+
@@properties.keys
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.properties_form
|
39
|
+
list = {}
|
40
|
+
@@properties.keys.each do |property|
|
41
|
+
list[property] = property
|
42
|
+
end
|
43
|
+
list
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|