ld4l-open_annotation_rdf 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 996d421c8a58b14c18ad5331339cc3b4a47aabcb
4
- data.tar.gz: ebfc32df7ef5b5032f9a6cbd46e1ec4fc0752b51
3
+ metadata.gz: efbc3d8423150742b110eec287f640b819db3a7b
4
+ data.tar.gz: a99be5482b844af7b94a3853af03ea32c9cd8698
5
5
  SHA512:
6
- metadata.gz: 869d278fc412af9c22df0397dd19060605d4dd07d82bd4e46a407dc6f38507fdb73e20acbc04c1a809e4ea3bf6c73ecddd2d0aa3fdd66241e6734bb69b8c2015
7
- data.tar.gz: 0e1cfbad3520be214c5943787d625b40caeab7554edeec229dd9036015102ef0c3d3df06c52e45e213ff32e59f7eb674ffd74fc4ac3cebcb217f211a37b04a31
6
+ metadata.gz: a982ffbf744c568ab1aee9408d47174d1c6036f2ca1d07bbb89d99159af666339df383e3d67bd65db0f695240798c47cdb68bb24e474ddfd04935c7f5fe68434
7
+ data.tar.gz: 507a364ac06b47bd7a4bbcabb88787acf81b01d50e5ff9084e07ada148c82e10efe15d4e0b47e1706f1f9226b2f0f277a4a91b0ca9d1d4790401e0159d2bac64
data/README.md CHANGED
@@ -122,42 +122,79 @@ puts stb.dump :ttl
122
122
  <http://example.org/term/engineering> a <http://www.w3.org/ns/oa#SemanticTag> .
123
123
  ```
124
124
 
125
+ *Resume annotation of known type.*
126
+ This is the more efficient approach and should be used if the type of the annotation is known.
127
+ ```
128
+ a1 = LD4L::OpenAnnotationRDF::CommentAnnotation.resume(RDF::URI('http://localhost/c10'))
129
+ # => #<LD4L::OpenAnnotationRDF::CommentAnnotation:0x3fdd8267adc8(default)>
130
+ comment = a1.getComment
131
+ # => "This book is a good resource on archery technique."
132
+
133
+ a2 = LD4L::OpenAnnotationRDF::TagAnnotation.resume(RDF::URI('http://localhost/t10'))
134
+ # => #<LD4L::OpenAnnotationRDF::TagAnnotation:0x3fdd826073f0(default)>
135
+ tag = a2.getTag
136
+ # => "archery"
137
+
138
+ a3 = LD4L::OpenAnnotationRDF::SemanticTagAnnotation.resume(RDF::URI('http://localhost/st10'))
139
+ # => #<LD4L::OpenAnnotationRDF::SemanticTagAnnotation:0x3fdd8259c7a8(default)>
140
+ term = a2.getTerm
141
+ # => #<RDF::URI:0x3fdbb4f37300 URI:http://example.org/term/engineering>
142
+ ```
143
+
125
144
  *Resume annotation of unknown type.*
126
145
  ```
127
146
  ## Using RDF::URI
128
147
  # Create the annotations first using previous examples.
129
148
  a1 = LD4L::OpenAnnotationRDF::Annotation.resume(RDF::URI('http://localhost/c10'))
130
149
  # => #<LD4L::OpenAnnotationRDF::CommentAnnotation:0x3fdd8267adc8(default)>
150
+ comment = a1.getComment
151
+ # => "This book is a good resource on archery technique."
131
152
 
132
153
  a2 = LD4L::OpenAnnotationRDF::Annotation.resume(RDF::URI('http://localhost/t10'))
133
154
  # => #<LD4L::OpenAnnotationRDF::TagAnnotation:0x3fdd826073f0(default)>
155
+ tag = a2.getTag
156
+ # => "archery"
134
157
 
135
158
  a3 = LD4L::OpenAnnotationRDF::Annotation.resume(RDF::URI('http://localhost/st10'))
136
159
  # => #<LD4L::OpenAnnotationRDF::SemanticTagAnnotation:0x3fdd8259c7a8(default)>
160
+ term = a2.getTerm
161
+ # => #<RDF::URI:0x3fdbb4f37300 URI:http://example.org/term/engineering>
137
162
 
138
163
 
139
164
  ## Using string URI
140
165
  # Create the annotations first using previous examples.
141
166
  a1 = LD4L::OpenAnnotationRDF::Annotation.resume('http://localhost/c10')
142
167
  # => #<LD4L::OpenAnnotationRDF::CommentAnnotation:0x3fdd8267adc8(default)>
168
+ # => #<LD4L::OpenAnnotationRDF::CommentAnnotation:0x3fdd8267adc8(default)>
169
+ comment = a1.getComment
143
170
 
144
171
  a2 = LD4L::OpenAnnotationRDF::Annotation.resume('http://localhost/t10')
145
172
  # => #<LD4L::OpenAnnotationRDF::TagAnnotation:0x3fdd826073f0(default)>
173
+ tag = a2.getTag
174
+ # => "archery"
146
175
 
147
176
  a3 = LD4L::OpenAnnotationRDF::Annotation.resume('http://localhost/st10')
148
177
  # => #<LD4L::OpenAnnotationRDF::SemanticTagAnnotation:0x3fdd8259c7a8(default)>
178
+ term = a2.getTerm
179
+ # => #<RDF::URI:0x3fdbb4f37300 URI:http://example.org/term/engineering>
149
180
 
150
181
 
151
182
  ## Using localname expanded using configured base_uri
152
183
  # Create the annotations first using previous examples.
153
184
  a1 = LD4L::OpenAnnotationRDF::Annotation.resume('c10')
154
185
  # => #<LD4L::OpenAnnotationRDF::CommentAnnotation:0x3fdd8267adc8(default)>
186
+ comment = a1.getComment
187
+ # => "This book is a good resource on archery technique."
155
188
 
156
189
  a2 = LD4L::OpenAnnotationRDF::Annotation.resume('t10')
157
190
  # => #<LD4L::OpenAnnotationRDF::TagAnnotation:0x3fdd826073f0(default)>
191
+ tag = a2.getTag
192
+ # => "archery"
158
193
 
159
194
  a3 = LD4L::OpenAnnotationRDF::Annotation.resume('st10')
160
195
  # => #<LD4L::OpenAnnotationRDF::SemanticTagAnnotation:0x3fdd8259c7a8(default)>
196
+ term = a2.getTerm
197
+ # => #<RDF::URI:0x3fdbb4f37300 URI:http://example.org/term/engineering>
161
198
  ```
162
199
 
163
200
  ### Configurations
@@ -13,6 +13,15 @@ module LD4L
13
13
  # TODO: Should a semantic tag be destroyed when the last annotation referencing the term is destroyed?
14
14
  # TODO: What if other triples have been attached beyond the type?
15
15
 
16
+ ##
17
+ # Get the term URI of the semantic tag body.
18
+ #
19
+ # @return the term URI
20
+ def getTerm
21
+ # return existing body if term is unchanged
22
+ @body ? @body.rdf_subject : nil
23
+ end
24
+
16
25
  ##
17
26
  # Set the hasBody property to the URI of the controlled vocabulary term that is the annotation and
18
27
  # create the semantic tag body instance identifying the term as a semantic tag annotation.
@@ -1,5 +1,5 @@
1
1
  module LD4L
2
2
  module OpenAnnotationRDF
3
- VERSION = "0.0.11"
3
+ VERSION = "0.0.12"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ld4l-open_annotation_rdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - E. Lynette Rayle