Created
June 19, 2012 14:19
-
-
Save moustaki/2954469 to your computer and use it in GitHub Desktop.
This file contains 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 'helper' | |
class EasySparqlTest < Test::Unit::TestCase | |
class Programme | |
include EasySparql | |
attr_accessor :title | |
end | |
def test_find_all_by_sparql | |
load_rdf '<http://ex.co/programme-1> rdf:type po:Programme . | |
<http://ex.co/programme-1> dc:title "Programme" . | |
<http://ex.co/programme-2> rdf:type po:Version . | |
<http://ex.co/programme-2> dc:title "Version" .' | |
programmes = Programme.find_all_by_sparql( [ :title ], [ | |
[ :uri, RDF.type, RDF::PO.Programme ], | |
[ :uri, RDF::DC11.title, :title ], | |
]) | |
assert_equal 1, programmes.size | |
assert_equal "Programme", programmes[0].title | |
assert_equal Programme, programmes[0].class | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment