From 0e7f3c196b123acd9d311f02f09f8b03992cea5f Mon Sep 17 00:00:00 2001 From: mr Date: Tue, 19 Jan 2010 10:02:09 +0100 Subject: move authorization to branch test --- lib/dataset.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/dataset.rb') diff --git a/lib/dataset.rb b/lib/dataset.rb index 8d1c0c1..f4372be 100644 --- a/lib/dataset.rb +++ b/lib/dataset.rb @@ -78,7 +78,7 @@ module OpenTox end def self.create(data, content_type = 'application/rdf+xml') - uri = RestClient.post @@config[:services]["opentox-dataset"], data, :content_type => content_type + uri = RestClient::Resource.new(@@config[:services]["opentox-dataset"], :user => request.username, :password => request.password).post data, :content_type => content_type dataset = Dataset.new dataset.read uri.to_s dataset @@ -168,11 +168,12 @@ module OpenTox # Delete a dataset def delete - RestClient.delete @uri - end + resource = RestClient::Resource.new(@uri, :user => request.username, :password => request.password) + resource.delete + end def save - RestClient.post(@@config[:services]["opentox-dataset"], self.rdf, :content_type => "application/rdf+xml").to_s + RestClient::Resource.new(@@config[:services]["opentox-dataset"], :user => request.username, :password => request.password).post(self.rdf, :content_type => "application/rdf+xml").to_s end def to_yaml -- cgit v1.2.3 From a165822a7bd663916cff9484a76e6bb6bcf9a353 Mon Sep 17 00:00:00 2001 From: mr Date: Mon, 25 Jan 2010 09:29:21 +0100 Subject: internal authorization with first user of users.yaml --- lib/dataset.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/dataset.rb') diff --git a/lib/dataset.rb b/lib/dataset.rb index f4372be..1aa3469 100644 --- a/lib/dataset.rb +++ b/lib/dataset.rb @@ -78,7 +78,8 @@ module OpenTox end def self.create(data, content_type = 'application/rdf+xml') - uri = RestClient::Resource.new(@@config[:services]["opentox-dataset"], :user => request.username, :password => request.password).post data, :content_type => content_type + resource = RestClient::Resource.new(@@config[:services]["opentox-dataset"], :user => @@users[:users].keys[0], :password => @@users[:users].values[0]) + uri = resource.post data, :content_type => content_type dataset = Dataset.new dataset.read uri.to_s dataset @@ -168,12 +169,12 @@ module OpenTox # Delete a dataset def delete - resource = RestClient::Resource.new(@uri, :user => request.username, :password => request.password) + resource = RestClient::Resource.new(@uri, :user => @@users[:users].keys[0], :password => @@users[:users].values[0]) resource.delete end def save - RestClient::Resource.new(@@config[:services]["opentox-dataset"], :user => request.username, :password => request.password).post(self.rdf, :content_type => "application/rdf+xml").to_s + RestClient::Resource.new(@@config[:services]["opentox-dataset"], :user => @@users[:users].keys[0], :password => @@users[:users].values[0]).post(self.rdf, :content_type => "application/rdf+xml").to_s end def to_yaml -- cgit v1.2.3 From 33d59523b3340d213b2bee58cde5de9ff4bffe99 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Mon, 15 Feb 2010 10:14:43 +0100 Subject: OWL-DL partially fixed according to Ninas suggestions --- lib/dataset.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/dataset.rb') diff --git a/lib/dataset.rb b/lib/dataset.rb index 3971537..65e1e6b 100644 --- a/lib/dataset.rb +++ b/lib/dataset.rb @@ -14,6 +14,8 @@ module OpenTox data_entry = @model.subject OT['compound'], compound if data_entry.nil? data_entry = @model.create_resource + dataset = @model.subject(RDF['type'],OT[self.owl_class]) + @model.add dataset, RDF['dataEntry'], data_entry @model.add data_entry, RDF['type'], OT["DataEntry"] @model.add data_entry, OT['compound'], compound end @@ -29,6 +31,8 @@ module OpenTox data_entry = @model.subject OT['compound'], compound if data_entry.nil? data_entry = @model.create_resource + dataset = @model.subject(RDF['type'],OT[self.owl_class]) + @model.add dataset, RDF['dataEntry'], data_entry @model.add data_entry, RDF['type'], OT["DataEntry"] @model.add data_entry, OT['compound'], compound end @@ -57,7 +61,7 @@ module OpenTox def find_or_create_compound(uri) compound = @model.subject(DC["identifier"], uri) if compound.nil? - compound = @model.create_resource + compound = @model.create_resource(uri) @model.add compound, RDF['type'], OT["Compound"] @model.add compound, DC["identifier"], uri end @@ -68,7 +72,7 @@ module OpenTox def find_or_create_feature(uri) feature = @model.subject(DC["identifier"], uri) if feature.nil? - feature = @model.create_resource + feature = @model.create_resource(uri) @model.add feature, RDF['type'], OT["Feature"] @model.add feature, DC["identifier"], uri @model.add feature, DC["title"], File.basename(uri).split(/#/)[1] -- cgit v1.2.3 From 8946f755a1b6063d424263924acefce0d0d9d49e Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Tue, 16 Feb 2010 16:22:14 +0100 Subject: data_entry linked to dataset --- lib/dataset.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/dataset.rb') diff --git a/lib/dataset.rb b/lib/dataset.rb index f8f4a1b..e4e4e9d 100644 --- a/lib/dataset.rb +++ b/lib/dataset.rb @@ -15,7 +15,7 @@ module OpenTox if data_entry.nil? data_entry = @model.create_resource dataset = @model.subject(RDF['type'],OT[self.owl_class]) - @model.add dataset, RDF['dataEntry'], data_entry + @model.add dataset, OT['dataEntry'], data_entry @model.add data_entry, RDF['type'], OT["DataEntry"] @model.add data_entry, OT['compound'], compound end @@ -32,7 +32,7 @@ module OpenTox if data_entry.nil? data_entry = @model.create_resource dataset = @model.subject(RDF['type'],OT[self.owl_class]) - @model.add dataset, RDF['dataEntry'], data_entry + @model.add dataset, OT['dataEntry'], data_entry @model.add data_entry, RDF['type'], OT["DataEntry"] @model.add data_entry, OT['compound'], compound end -- cgit v1.2.3