pius-dm-semantic 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +5 -26
- data/dm-semantic.gemspec +2 -1
- data/lib/dm-semantic.rb +4 -0
- data/spec/spec_helper.rb +2 -2
- metadata +10 -1
data/README.markdown
CHANGED
@@ -37,40 +37,19 @@ DM-Semantic depends on Reddy (http://github.com/tommorris/reddy).
|
|
37
37
|
|
38
38
|
> sudo gem install reddy
|
39
39
|
|
40
|
-
3. **Require the gem
|
40
|
+
3. **Require the gem**
|
41
|
+
|
42
|
+
4. Now, you can use RDF in your model. See specs for examples.
|
41
43
|
|
42
44
|
To use the special RDFGraph type, create a property with the type in your model. For example:
|
43
45
|
|
44
46
|
> property :graph, RDFGraph
|
45
47
|
|
46
|
-
|
47
|
-
|
48
|
-
>> c = Concept.new(:slug => "pius", :graph => "<http://pius.github.com#me> <http://xmlns.com/foaf/0.1/name> \"Pius Uzamere\" .
|
49
|
-
<http://pius.github.com#me> <http://xmlns.com/foaf/0.1/homepage> \"Pius Uzamere\" .")
|
50
|
-
=> #<Concept id=nil slug="pius" graph="<http://pius.github.com#me> <http://xmlns.com/foaf/0.1/name> \"Pius Uzamere\" . \n<http://pius.github.com#me> <http://xmlns.com/foaf/0.1/homepage> \"Pius Uzamere\" .">
|
51
|
-
>> c.save
|
52
|
-
~ (0.000087) SELECT "id", "slug" FROM "concepts" WHERE ("slug" = 'pius') ORDER BY "id", "slug" LIMIT 1
|
53
|
-
~ (0.002364) INSERT INTO "concepts" ("graph", "slug") VALUES ('<http://pius.github.com#me> <http://xmlns.com/foaf/0.1/name> "Pius Uzamere" .
|
54
|
-
<http://pius.github.com#me> <http://xmlns.com/foaf/0.1/homepage> "Pius Uzamere" .', 'pius')
|
55
|
-
=> true
|
56
|
-
>> exit
|
57
|
-
|
58
|
-
Then, later:
|
59
|
-
|
60
|
-
>> c = Concept.first
|
61
|
-
~ (0.000086) SELECT "id", "slug" FROM "concepts" ORDER BY "id", "slug" LIMIT 1
|
62
|
-
=> #<Concept id=4 slug="pius" graph=<not loaded>>
|
63
|
-
>> c.graph
|
64
|
-
~ (0.000084) SELECT "graph", "id", "slug" FROM "concepts" WHERE ("id" = 4) AND ("slug" = 'pius') ORDER BY "id", "slug"
|
65
|
-
=> #<Reddy::Graph:0x2742a3c @nsbinding={}, @triples=[[#<Reddy::URIRef:0x274262c @uri=#<Addressable::URI:0x13a0d1c URI:http://pius.github.com#me>, #<Reddy::URIRef:0x27415b0 @uri=#<Addressable::URI:0x13a03da URI:http://xmlns.com/foaf/0.1/name>, #<Reddy::Literal:0x27404f8 @encoding=<theReddy::TypeLiteral::Encoding::Null>, contents"Pius Uzamere"], [#<Reddy::URIRef:0x2742690 @uri=#<Addressable::URI:0x13a0024 URI:http://pius.github.com#me>, #<Reddy::URIRef:0x273fc10 @uri=#<Addressable::URI:0x139fc5a URI:http://xmlns.com/foaf/0.1/homepage>, #<Reddy::Literal:0x273f670 @encoding=<theReddy::TypeLiteral::Encoding::Null>, contents"Pius Uzamere"]]
|
66
|
-
>>
|
67
|
-
|
68
|
-
|
69
|
-
4. **Read the documentation**
|
48
|
+
5. **Read the documentation**
|
70
49
|
|
71
50
|
It's YARD. It's sexy.
|
72
51
|
|
73
|
-
|
52
|
+
6. **Contribute!**
|
74
53
|
|
75
54
|
Fork my repository (http://github.com/pius/dm-semantic), make some changes, and send along a pull request!
|
76
55
|
|
data/dm-semantic.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "dm-semantic"
|
3
|
-
s.version = "0.0.
|
3
|
+
s.version = "0.0.3"
|
4
4
|
s.date = "2009-01-08"
|
5
5
|
s.summary = "DM-Semantic is a DataMapper plugin for adding semantic capabilities to models."
|
6
6
|
s.email = "pius+github@alum.mit.edu"
|
@@ -14,4 +14,5 @@ Gem::Specification.new do |s|
|
|
14
14
|
#s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
15
15
|
s.add_dependency("dm-types", ["> 0.9.6"])
|
16
16
|
s.add_dependency("reddy", ["> 0.0.1"])
|
17
|
+
s.add_dependency("curies", ["> 0.0.1"])
|
17
18
|
end
|
data/lib/dm-semantic.rb
CHANGED
@@ -7,6 +7,9 @@ require 'dm-core'
|
|
7
7
|
gem 'reddy'
|
8
8
|
require 'reddy'
|
9
9
|
|
10
|
+
gem 'curies'
|
11
|
+
require 'curies'
|
12
|
+
|
10
13
|
class Pathname
|
11
14
|
def /(path)
|
12
15
|
(self + path).expand_path
|
@@ -22,5 +25,6 @@ module DataMapper
|
|
22
25
|
module Types
|
23
26
|
dir = (Pathname(__FILE__).dirname.expand_path / 'dm-semantic/types' ).to_s
|
24
27
|
autoload :RDFGraph, dir / 'rdf_graph'
|
28
|
+
autoload :Curie, dir / 'curie'
|
25
29
|
end
|
26
30
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'pathname'
|
3
3
|
|
4
|
-
gem 'dm-core', '
|
4
|
+
gem 'dm-core', '>0.9.6'
|
5
5
|
require 'dm-core'
|
6
6
|
|
7
7
|
spec_dir_path = Pathname(__FILE__).dirname.expand_path
|
@@ -13,7 +13,7 @@ def load_driver(name, default_uri)
|
|
13
13
|
lib = "do_#{name}"
|
14
14
|
|
15
15
|
begin
|
16
|
-
gem lib, '
|
16
|
+
gem lib, '>0.9.6'
|
17
17
|
require lib
|
18
18
|
DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri)
|
19
19
|
DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pius-dm-semantic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pius Uzamere
|
@@ -30,6 +30,15 @@ dependencies:
|
|
30
30
|
- !ruby/object:Gem::Version
|
31
31
|
version: 0.0.1
|
32
32
|
version:
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: curies
|
35
|
+
version_requirement:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.0.1
|
41
|
+
version:
|
33
42
|
description: DM-Semantic is a DataMapper plugin for adding semantic capabilities to models.
|
34
43
|
email: pius+github@alum.mit.edu
|
35
44
|
executables: []
|