easy_data 0.0.92 → 0.0.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +44 -0
- data/lib/controllers/easy_datas_controller.rb +38 -19
- data/lib/easy_data/tasks.rb +2 -0
- data/lib/easy_data/templates/stylesheets/easy_data_style.css +6 -3
- data/lib/easy_data/version.rb +1 -1
- data/lib/easy_data.rb +2 -1
- data/lib/routes.rb +39 -33
- metadata +9 -11
- data/.gemrc +0 -8
- data/.gemtest +0 -1
- data/.gitignore +0 -9
- data/README +0 -35
data/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Installation
|
|
2
|
+
--------------
|
|
3
|
+
|
|
4
|
+
In config/routes.rb at the end of routes declarations include:
|
|
5
|
+
|
|
6
|
+
EasyDataRouting.routes(map)
|
|
7
|
+
|
|
8
|
+
<p>After, in [RAILS_HOME]/Rakefile copy this line:</p>
|
|
9
|
+
|
|
10
|
+
<pre><code> require "easy_data/tasks" </code></pre>
|
|
11
|
+
|
|
12
|
+
<p>At the end, execute the next task:</p>
|
|
13
|
+
|
|
14
|
+
<pre><code> rake easy_data:install RAILS_ENV=development </code></pre>
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
<p>To start with administration, you should assign at admin user:</p>
|
|
18
|
+
|
|
19
|
+
<pre><code> rake easy_data:add_user[user,pass] RAILS_ENV=development </code></pre>
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
Commandas and Query
|
|
23
|
+
--------------------
|
|
24
|
+
|
|
25
|
+
<p>To get all possibles querys and URI's offers use this url:</p>
|
|
26
|
+
|
|
27
|
+
<pre><code> http://[project_host]/list_models </code></pre>
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
<p>After, to get any information about any model or resource, used this url: </p>
|
|
31
|
+
|
|
32
|
+
<pre><code> http://[project_host]/foaf/[model]/[id][.format] </code></pre>
|
|
33
|
+
|
|
34
|
+
<ul>
|
|
35
|
+
<li>[model] = any model list in first url</li>
|
|
36
|
+
<li>[id] = to get any information with primary key</li>
|
|
37
|
+
<li>[format] = this is for advance users, get response in this format</li>
|
|
38
|
+
</ul>
|
|
39
|
+
|
|
40
|
+
Collaborations
|
|
41
|
+
------------------
|
|
42
|
+
|
|
43
|
+
<p>If you want to collaborate on this project or have any ideas and would like to share, please email me at my email, all are welcome!</p>
|
|
44
|
+
<p><a href="mailto:jnillo9@gmail.com" title="jnillo's mail">jnillo9@gmail.com</a></p>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require "action_controller"
|
|
1
2
|
require "action_view"
|
|
2
3
|
require "builder"
|
|
3
4
|
|
|
@@ -8,29 +9,35 @@ class EasyDatasController < ActionController::Base
|
|
|
8
9
|
before_filter :authenticated, :only => [:custom_rdf]
|
|
9
10
|
|
|
10
11
|
def show
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
|
|
13
|
+
if params[:id].nil? && params[:model] == params[:model].pluralize #Because, the model's name is the sames in pluralize format, example: News
|
|
14
|
+
redirect_to :action => "show_all",:locals => {:model => params[:model]}
|
|
15
|
+
end
|
|
16
|
+
begin
|
|
17
|
+
model = eval params[:model].to_s
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
conditions = parser_params(params)
|
|
20
|
+
|
|
21
|
+
rdf = ModelRdf.new
|
|
22
|
+
|
|
23
|
+
no_valid = lambda{|c| c.nil?||c.empty?}
|
|
24
|
+
|
|
25
|
+
@reply = model.find :all, :conditions => {:id => params[:id]}
|
|
26
|
+
|
|
27
|
+
unless @reply.nil?
|
|
28
|
+
@host="http://"+request.env["HTTP_HOST"]
|
|
22
29
|
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
@rdf_model = rdf.get_model_rdf(@reply,params[:model],"http://"+request.env["HTTP_HOST"])
|
|
31
|
+
end
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
@xml = Builder::XmlMarkup.new
|
|
27
34
|
|
|
28
35
|
if no_valid.call(@rdf_model[:header]) || @reply.nil? # If the URI not available or data no publicated
|
|
29
36
|
render :nothing => true, :status => 400
|
|
30
37
|
else
|
|
31
38
|
respond_to do |format|
|
|
32
39
|
format.html
|
|
33
|
-
format.xml
|
|
40
|
+
format.xml # render :template => "/rdf/request.xml.builder"
|
|
34
41
|
end
|
|
35
42
|
end
|
|
36
43
|
rescue
|
|
@@ -45,12 +52,12 @@ class EasyDatasController < ActionController::Base
|
|
|
45
52
|
rdf = ModelRdf.new
|
|
46
53
|
|
|
47
54
|
no_valid = lambda{|c| c.nil?||c.empty?}
|
|
48
|
-
|
|
55
|
+
|
|
49
56
|
@reply = model.find :all || nil
|
|
57
|
+
|
|
58
|
+
@host="http://"+request.env["SERVER_NAME"]
|
|
50
59
|
|
|
51
|
-
@
|
|
52
|
-
|
|
53
|
-
@rdf_model = rdf.get_model_rdf(@reply,params[:model],"http://"+request.env["HTTP_HOST"])
|
|
60
|
+
@rdf_model = rdf.get_model_rdf(@reply,params[:model],"http://"+request.env["SERVER_NAME"])
|
|
54
61
|
|
|
55
62
|
@xml = Builder::XmlMarkup.new
|
|
56
63
|
|
|
@@ -59,7 +66,7 @@ class EasyDatasController < ActionController::Base
|
|
|
59
66
|
else
|
|
60
67
|
respond_to do |format|
|
|
61
68
|
format.html
|
|
62
|
-
format.xml
|
|
69
|
+
format.xml # render :template => "/rdf/request.xml.builder"
|
|
63
70
|
end
|
|
64
71
|
end
|
|
65
72
|
rescue
|
|
@@ -86,6 +93,18 @@ class EasyDatasController < ActionController::Base
|
|
|
86
93
|
end
|
|
87
94
|
end
|
|
88
95
|
|
|
96
|
+
# Information about access to publicated data
|
|
97
|
+
def access_to_data
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Generate Linked Data Graph
|
|
101
|
+
def linked_data
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# FAQ
|
|
105
|
+
def faq
|
|
106
|
+
end
|
|
107
|
+
|
|
89
108
|
def custom_rdf
|
|
90
109
|
@models = DataModels.load_models
|
|
91
110
|
@settings ||= YAML::load(File.open("#{RAILS_ROOT}/config/easy_data/setting.yaml"))
|
data/lib/easy_data/tasks.rb
CHANGED
|
@@ -48,12 +48,15 @@ div.attributes_info div.property span.attribute{font-size:1.15em;font-weight:bol
|
|
|
48
48
|
.ed_info_content .settings_table{text-align:left;margin-left:5%;margin-bottom:5%;width:90%}
|
|
49
49
|
.ed_info_content .settings_table th{padding: 10px 0}
|
|
50
50
|
.ed_info_content ul{margin-left:20px}
|
|
51
|
-
|
|
52
|
-
.
|
|
51
|
+
|
|
52
|
+
.title_data_publications{color:#808080;background-color:#DDBC8F;font-weight:bold;width:100%;display:block;padding: 5px 10px;overflow:hidden;margin:20px 0;}
|
|
53
|
+
.ed_info_content .ed_info_models .data_info{text-decoration:underline;color:#085DAD;font-size:15px;width:100%;display:block;}
|
|
54
|
+
.title_model{background:url("images/rdf_icon.png") no-repeat 0 0;padding-left:40px;margin-bottom:20px;width:100%;display:block;color:#808080;font-weight:bold;font-size:30px}
|
|
53
55
|
.linked_data_graphs{margin:50px 0 0 80px;}
|
|
54
56
|
.linked_data_access{border:1px #ccc solid;width:95%;height:auto;overflow:hidden;margin-top:20px}
|
|
55
|
-
.lock{background:url("
|
|
57
|
+
.lock{background:url("images/lock.png") no-repeat top right;padding-right:18px;}
|
|
56
58
|
.simple_data{margin-left:20px;}
|
|
59
|
+
|
|
57
60
|
/*Footer*/
|
|
58
61
|
|
|
59
62
|
.easy_data_footer,.push{height:100px;bottom:0;display:block}
|
data/lib/easy_data/version.rb
CHANGED
data/lib/easy_data.rb
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
require "easy_data/version"
|
|
2
2
|
require "data_models/data_models"
|
|
3
|
+
require "action_controller"
|
|
3
4
|
require "controllers/easy_datas_controller"
|
|
4
5
|
require "data_models/model_rdf"
|
|
5
6
|
require "data_models/linked_data_graph"
|
|
6
7
|
require "data_models/RDFa"
|
|
7
8
|
require "routes"
|
|
8
|
-
require '
|
|
9
|
+
require 'fileutils'
|
|
9
10
|
require 'ruby-debug'
|
|
10
11
|
|
|
11
12
|
|
data/lib/routes.rb
CHANGED
|
@@ -1,39 +1,45 @@
|
|
|
1
|
+
require "action_controller"
|
|
2
|
+
|
|
1
3
|
module EasyDataRouting
|
|
2
|
-
def self.routes
|
|
4
|
+
def self.routes(map)
|
|
5
|
+
|
|
6
|
+
map.with_options :controller => 'easy_datas' do |ed_routes|
|
|
7
|
+
ed_routes.with_options :conditions => {:method => :get} do |ed_views|
|
|
8
|
+
ed_views.connect 'easy_datas/custom_rdf', :action=> "custom_rdf"
|
|
9
|
+
ed_views.connect 'easy_data', :action => "custom_rdf"
|
|
10
|
+
ed_views.connect 'easy_datas/authenticate_user', :action => "authenticate_user"
|
|
11
|
+
|
|
12
|
+
ed_views.connect 's/data_publications', :action => 'info_easy_data'
|
|
13
|
+
ed_views.connect 'easy_datas/info_easy_data', :action => 'info_easy_data'
|
|
14
|
+
ed_views.connect 'easy_datas/linked_data', :action => 'linked_data'
|
|
15
|
+
ed_views.connect 'easy_datas/access_to_data', :action => 'access_to_data'
|
|
16
|
+
ed_views.connect 'easy_datas/faq', :action => 'faq'
|
|
17
|
+
|
|
18
|
+
ed_views.connect 'easy_datas/logout', :action => 'logout'
|
|
19
|
+
DataModels.load_models.each do |model|
|
|
20
|
+
ed_views.connect "s/#{model.gsub("::","_")}", :controller => "easy_datas",
|
|
21
|
+
:action => 'show',
|
|
22
|
+
:model => model,
|
|
23
|
+
:format => 'xml'
|
|
24
|
+
ed_views.connect "s/#{model.gsub("::","_").pluralize}", :controller => "easy_datas",
|
|
25
|
+
:action => 'show_all',
|
|
26
|
+
:model => model,
|
|
27
|
+
:format => 'xml'
|
|
3
28
|
|
|
4
|
-
resources :easy_datas do
|
|
5
|
-
member do
|
|
6
|
-
#GET
|
|
7
|
-
get '/custom_rdf', :to => "easy_datas#custom_rdf"
|
|
8
|
-
get '/authenticate_user',:to => "easy_datas#authenticate_user"
|
|
9
|
-
get '/s/data_publications', :to => 'easy_datas#info_easy_data'
|
|
10
|
-
get '/info_easy_data', :to => 'easy_datas#info_easy_data'
|
|
11
|
-
get '/linked_data', :to => 'easy_datas#linked_data'
|
|
12
|
-
get '/access_to_data', :to => 'easy_datas#access_to_data'
|
|
13
|
-
get '/faq', :to => 'easy_datas#faq'
|
|
14
|
-
get '/logout', :to => 'easy_datas#logout'
|
|
15
|
-
#POST
|
|
16
|
-
post '/model_attributes_info', :to => "easy_datas#model_attributes_info"
|
|
17
|
-
post '/load_linked_data_graph', :to => "easy_datas#load_linked_data_graph"
|
|
18
|
-
post '/model_attributes/:model', :to => 'easy_datas#model_attributes'
|
|
19
|
-
post '/model_attributes_edit/:model', :to => 'easy_datas#model_attributes_edit'
|
|
20
|
-
post '/load_properties/:block/:attribute', :to => 'easy_datas#load_properties'
|
|
21
|
-
post '/login', :to => 'easy_datas#login'
|
|
22
|
-
post '/custom_attributes/:model', :to => 'easy_datas#custom_attributes'
|
|
23
|
-
post '/settings', :to => 'easy_datas#settings'
|
|
24
|
-
post '/custom_settings', :to => 'easy_datas#custom_settings'
|
|
25
|
-
post '/view_settings', :to => 'easy_datas#view_settings'
|
|
26
29
|
end
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
end
|
|
31
|
+
ed_routes.with_options :conditions => {:method => :post} do |ed_actions|
|
|
32
|
+
ed_actions.connect 'easy_datas/model_attributes_info', :action => "model_attributes_info"
|
|
33
|
+
ed_actions.connect 'easy_datas/load_linked_data_graph', :action => "load_linked_data_graph"
|
|
34
|
+
ed_actions.connect 'easy_datas/model_attributes/:model', :action => 'model_attributes'
|
|
35
|
+
ed_actions.connect 'easy_datas/model_attributes_edit/:model', :action => 'model_attributes_edit'
|
|
36
|
+
ed_actions.connect 'easy_datas/load_properties/:block/:attribute', :action => 'load_properties'
|
|
37
|
+
ed_actions.connect 'easy_datas/login', :action => 'login'
|
|
38
|
+
ed_actions.connect 'easy_datas/custom_attributes/:model', :action => 'custom_attributes'
|
|
39
|
+
end
|
|
34
40
|
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
#Ajax routes:
|
|
42
|
+
# map.resources :easy_datas,:member => {:load_properties => :post}
|
|
43
|
+
end
|
|
37
44
|
end
|
|
38
45
|
end
|
|
39
|
-
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: easy_data
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
5
|
-
prerelease:
|
|
4
|
+
hash: 161
|
|
5
|
+
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
version: 0.0.
|
|
9
|
+
- 95
|
|
10
|
+
version: 0.0.95
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- jnillo
|
|
@@ -15,7 +15,8 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date:
|
|
18
|
+
date: 2012-11-27 00:00:00 +01:00
|
|
19
|
+
default_executable:
|
|
19
20
|
dependencies:
|
|
20
21
|
- !ruby/object:Gem::Dependency
|
|
21
22
|
name: hpricot
|
|
@@ -75,16 +76,13 @@ extensions: []
|
|
|
75
76
|
extra_rdoc_files: []
|
|
76
77
|
|
|
77
78
|
files:
|
|
78
|
-
- .gemrc
|
|
79
|
-
- .gemtest
|
|
80
|
-
- .gitignore
|
|
81
79
|
- .idea/EasyData.iml
|
|
82
80
|
- .idea/encodings.xml
|
|
83
81
|
- .idea/misc.xml
|
|
84
82
|
- .idea/modules.xml
|
|
85
83
|
- .idea/vcs.xml
|
|
86
84
|
- Gemfile
|
|
87
|
-
- README
|
|
85
|
+
- README.md
|
|
88
86
|
- Rakefile
|
|
89
87
|
- bin/linked_data
|
|
90
88
|
- easy_data.gemspec
|
|
@@ -161,6 +159,7 @@ files:
|
|
|
161
159
|
- test/unit/linked_data_graph_test.rb
|
|
162
160
|
- test/unit/model_rdf_test.rb
|
|
163
161
|
- test/unit/namespaces_test.rb
|
|
162
|
+
has_rdoc: true
|
|
164
163
|
homepage: http://rubygems.org/gem/easy_data
|
|
165
164
|
licenses: []
|
|
166
165
|
|
|
@@ -190,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
190
189
|
requirements: []
|
|
191
190
|
|
|
192
191
|
rubyforge_project: easy_data
|
|
193
|
-
rubygems_version: 1.
|
|
192
|
+
rubygems_version: 1.3.7
|
|
194
193
|
signing_key:
|
|
195
194
|
specification_version: 3
|
|
196
195
|
summary: Blau blau Easily publish the linked data data model of your project RoR
|
|
@@ -202,4 +201,3 @@ test_files:
|
|
|
202
201
|
- test/unit/linked_data_graph_test.rb
|
|
203
202
|
- test/unit/model_rdf_test.rb
|
|
204
203
|
- test/unit/namespaces_test.rb
|
|
205
|
-
has_rdoc:
|
data/.gemrc
DELETED
data/.gemtest
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
data/.gitignore
DELETED
data/README
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
Installation
|
|
2
|
-
===============
|
|
3
|
-
|
|
4
|
-
In config/routes.rb at the end of routes declarations include:
|
|
5
|
-
|
|
6
|
-
EasyDataRouting.routes(map)
|
|
7
|
-
|
|
8
|
-
After, in [RAILS_HOME]/Rakefile copy this line:
|
|
9
|
-
|
|
10
|
-
require "easy_data/tasks"
|
|
11
|
-
|
|
12
|
-
At the end, execute the next task:
|
|
13
|
-
|
|
14
|
-
rake easy_data:install RAILS_ENV=development
|
|
15
|
-
|
|
16
|
-
To start with administration, you should assign at admin user:
|
|
17
|
-
|
|
18
|
-
rake easy_data:add_user[user,pass] RAILS_ENV=development
|
|
19
|
-
|
|
20
|
-
Commandas and Query
|
|
21
|
-
======================
|
|
22
|
-
|
|
23
|
-
To get all possibles querys and URI's offers use this url:
|
|
24
|
-
|
|
25
|
-
http://[project_host]/list_models
|
|
26
|
-
|
|
27
|
-
After, to get any information about any model or resource, used this url:
|
|
28
|
-
|
|
29
|
-
http://[project_host]/foaf/[model]/[id][.format]
|
|
30
|
-
|
|
31
|
-
[model] = any model list in first url
|
|
32
|
-
[id] = to get any information with primary key
|
|
33
|
-
[format] = this is for advance users, get response in this format
|
|
34
|
-
|
|
35
|
-
|