Created
November 29, 2012 22:17
-
-
Save palexander/4172282 to your computer and use it in GitHub Desktop.
blank node error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module LinkedData | |
module Models | |
class Review < Goo::Base::Resource | |
model :review | |
validates :creator, :presence => true, :cardinality => { :maximum => 1 } | |
validates :created, :date_time_xsd => true, :presence => true, :cardinality => { :maximum => 1 } | |
validates :body, :presence => true, :cardinality => { :maximum => 1 } | |
validates :ontologyReviewed, :presence => true, :cardinality => { :maximum => 1 } | |
validates :usabilityRating, :cardinality => { :maximum => 1 } | |
validates :coverageRating, :cardinality => { :maximum => 1 } | |
validates :qualityRating, :cardinality => { :maximum => 1 } | |
validates :formalityRating, :cardinality => { :maximum => 1 } | |
validates :documentationRating, :cardinality => { :maximum => 1 } | |
def initialize(attributes = {}) | |
super(attributes) | |
end | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "goo" | |
require_relative "lib/serializer" | |
require_relative "lib/monkeypatches/to_flex_hash/object" | |
# Require all models | |
require_relative "lib/models/review" | |
# Setup repo connection | |
if Goo.store().nil? | |
Goo.configure do |conf| | |
conf[:stores] = [ { :name => :main , :host => "localhost", :port => 8080 , :options => { } } ] | |
end | |
end | |
# Setup Goo | |
vocabs = Goo::Naming::Vocabularies.new() | |
# Any property no defined in a prefix space | |
# will fall under this namespace | |
vocabs.default = "http://data.bioontology.org/metadata/" | |
vocabs.register(:metadata, "http://data.bioontology.org/metadata/", []) | |
vocabs.register_model(:metadata, :review, LinkedData::Models::Review) | |
Goo::Naming.register_vocabularies(vocabs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative "../../ontologies_linked_data" | |
require "test/unit" | |
require "pry" | |
class TestReview < Test::Unit::TestCase | |
def test_valid_review | |
r = LinkedData::Models::Review.new | |
assert (not r.valid?) | |
r.creator = "paul" | |
r.created = DateTime.parse("2012-10-04T07:00:00.000Z") | |
assert (not r.valid?) | |
r.body = "This is a test review" | |
r.ontologyReviewed = "SNOMED" | |
assert r.valid? | |
end | |
def test_review_save | |
r = LinkedData::Models::Review.new({ | |
:creator => "paul", | |
:created => DateTime.parse("2012-10-04T07:00:00.000Z"), | |
:body => "This is a test review", | |
:ontologyReviewed => "SNOMED" | |
}) | |
assert_equal false, r.exist?(reload=true) | |
r.save | |
assert_equal true, r.exist?(reload=true) | |
r.delete | |
assert_equal false, r.exist?(reload=true) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment