Module: EasyData
- Defined in:
- lib/easy_data.rb,
lib/easy_data/version.rb,
lib/data_models/namespaces.rb,
lib/data_models/namespaces/cc.rb,
lib/data_models/namespaces/dc.rb,
lib/data_models/namespaces/geo.rb,
lib/data_models/namespaces/owl.rb,
lib/data_models/namespaces/rsa.rb,
lib/data_models/namespaces/rss.rb,
lib/data_models/namespaces/wot.rb,
lib/data_models/namespaces/xsd.rb,
lib/data_models/namespaces/cert.rb,
lib/data_models/namespaces/dc11.rb,
lib/data_models/namespaces/doap.rb,
lib/data_models/namespaces/exif.rb,
lib/data_models/namespaces/foaf.rb,
lib/data_models/namespaces/http.rb,
lib/data_models/namespaces/rdfs.rb,
lib/data_models/namespaces/sioc.rb,
lib/data_models/namespaces/skos.rb,
lib/data_models/namespaces/xhtml.rb
Defined Under Namespace
Modules: RDF
Constant Summary collapse
- VERSION =
"0.0.3"
Class Method Summary collapse
-
.build_linked_data_graph ⇒ Object
Building Linked Data Graph.
- .get_style_path ⇒ Object
- .get_uri_namespace(namespace) ⇒ Object
- .get_view_path ⇒ Object
- .refresh_information ⇒ Object
- .yaml_description_model(model_data) ⇒ Object
Class Method Details
.build_linked_data_graph ⇒ Object
Building Linked Data Graph
62 63 64 |
# File 'lib/easy_data.rb', line 62 def self.build_linked_data_graph LinkedDataGraph.build(DataModels.load_models) end |
.get_style_path ⇒ Object
51 52 53 |
# File 'lib/easy_data.rb', line 51 def self.get_style_path File.join(File.dirname(__FILE__), 'easy_data/templates/stylesheets/easy_data_style.css') end |
.get_uri_namespace(namespace) ⇒ Object
55 56 57 |
# File 'lib/easy_data.rb', line 55 def self.get_uri_namespace(namespace) eval "RDF::#{namespace.upcase}.get_uri" end |
.get_view_path ⇒ Object
47 48 49 |
# File 'lib/easy_data.rb', line 47 def self.get_view_path File.join(File.dirname(__FILE__), 'easy_data/templates') end |
.refresh_information ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/easy_data.rb', line 67 def self.refresh_information rdf = ModelRdf.new models = DataModels.load_models unless self.info_update?(models,rdf) rdf_models = rdf.get_models.keys #Add the new models to rdf's information file models.each do |model| unless rdf_models.keys.include? model model_data = DataModels.get_model_data(model) if model_data.respond_to?:columns rdf.add_model(model,EasyData.yaml_description_model(eval model)) end end end #Delete the models how they had deleted rdf_models.each do |model| unless models.include?model rdf.delete_model model end end rdf.save end end |
.yaml_description_model(model_data) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/easy_data.rb', line 23 def self.yaml_description_model(model_data) attributes = {} associations = {} model_data.columns.each do |att| if att.primary attributes[att.name] = {:privacy => 'Private',:namespace => 'not defined',:property => 'not defined'} elsif att.name =~ /_id$/ attributes[att.name] = "no publication" else attributes[att.name] = {:privacy => 'Public',:namespace => 'not defined',:property => 'not defined'} end end model_data.reflections.keys.each do |ref| associations[ref.to_s] = {:privacy => 'Public',:namespace => 'not defined',:property => 'not defined'} end {:privacy => "Private",:namespace => "not defined",:property => "not defined","attributes" => attributes,"associations" => associations} end |