From cb3c1dd486ba0a891c81886c1546553fc17f01b8 Mon Sep 17 00:00:00 2001 From: ch Date: Thu, 12 May 2011 16:58:14 +0000 Subject: RDF serialization of metadata fixed for multiple RDF.types --- lib/serializer.rb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/serializer.rb b/lib/serializer.rb index 644a09f..e4cb541 100644 --- a/lib/serializer.rb +++ b/lib/serializer.rb @@ -26,6 +26,8 @@ module OpenTox OT.Algorithm => { RDF["type"] => [{ "type" => "uri", "value" => OWL['Class'] }] } , OT.Parameter => { RDF["type"] => [{ "type" => "uri", "value" => OWL['Class'] }] } , OT.Task => { RDF["type"] => [{ "type" => "uri", "value" => OWL['Class'] }] } , + OTA.PatternMiningSupervised => { RDF["type"] => [{ "type" => "uri", "value" => OWL['Class'] }] } , + #classes for validation OT.Validation => { RDF["type"] => [{ "type" => "uri", "value" => OWL['Class'] }] } , OT.ClassificationStatistics => { RDF["type"] => [{ "type" => "uri", "value" => OWL['Class'] }] } , @@ -40,10 +42,10 @@ module OpenTox OT.compound => { RDF["type"] => [{ "type" => "uri", "value" => OWL.ObjectProperty }] } , OT.feature => { RDF["type"] => [{ "type" => "uri", "value" => OWL.ObjectProperty }] } , OT.dataEntry => { RDF["type"] => [{ "type" => "uri", "value" => OWL.ObjectProperty }] } , - OT.acceptValue => { RDF["type"] => [{ "type" => "uri", "value" => OWL.ObjectProperty }] } , OT.values => { RDF["type"] => [{ "type" => "uri", "value" => OWL.ObjectProperty }] } , OT.algorithm => { RDF["type"] => [{ "type" => "uri", "value" => OWL.ObjectProperty }] } , OT.parameters => { RDF["type"] => [{ "type" => "uri", "value" => OWL.ObjectProperty }] } , + #object props for validation# OT.model => { RDF["type"] => [{ "type" => "uri", "value" => OWL.ObjectProperty }] } , OT.trainingDataset => { RDF["type"] => [{ "type" => "uri", "value" => OWL.ObjectProperty }] } , @@ -73,6 +75,8 @@ module OpenTox OT.hasStatus => { RDF["type"] => [{ "type" => "uri", "value" => OWL.AnnotationProperty }] } , OT.resultURI => { RDF["type"] => [{ "type" => "uri", "value" => OWL.AnnotationProperty }] } , OT.percentageCompleted => { RDF["type"] => [{ "type" => "uri", "value" => OWL.AnnotationProperty }] } , + OT.acceptValue => { RDF["type"] => [{ "type" => "uri", "value" => OWL.AnnotationProperty }] } , + # annotation props for validation OT.numUnpredicted => { RDF["type"] => [{ "type" => "uri", "value" => OWL.AnnotationProperty }] } , OT.crossvalidationFold => { RDF["type"] => [{ "type" => "uri", "value" => OWL.AnnotationProperty }] } , @@ -256,7 +260,8 @@ module OpenTox def add_metadata(uri,metadata) id = 0 metadata.each do |u,v| - if v.is_a? Array and u == OT.parameters + #if v.is_a? Array and (u == OT.parameters or u == RDF.type) + if v.is_a? Array and u == OT.parameters#or u == RDF.type) @object[uri][u] = [] unless @object[uri][u] v.each do |value| id+=1 @@ -267,7 +272,13 @@ module OpenTox @object[genid][name] = [{"type" => type(entry), "value" => entry }] end end - else # v.is_a? String + elsif v.is_a? Array and u == RDF.type + @object[uri] = {} unless @object[uri] + v.each do |value| + @object[uri][u] = [] unless @object[uri][u] + @object[uri][u] << {"type" => type(value), "value" => value } + end + elsif v.is_a? String @object[uri] = {} unless @object[uri] @object[uri][u] = [{"type" => type(v), "value" => v }] end @@ -309,6 +320,7 @@ module OpenTox OT.value => v } @object[feature][RDF["type"]] << { "type" => "uri", "value" => featuretype(value) } + #@object[feature][RDF["type"]] = { "type" => "uri", "value" => featuretype(value) } end # Serializers -- cgit v1.2.3