diff --git a/README.md b/README.md index 29339ae..116e25f 100644 --- a/README.md +++ b/README.md @@ -122,42 +122,79 @@ puts stb.dump :ttl a . ``` +*Resume annotation of known type.* +This is the more efficient approach and should be used if the type of the annotation is known. +``` +a1 = LD4L::OpenAnnotationRDF::CommentAnnotation.resume(RDF::URI('http://localhost/c10')) +# => # +comment = a1.getComment +# => "This book is a good resource on archery technique." + +a2 = LD4L::OpenAnnotationRDF::TagAnnotation.resume(RDF::URI('http://localhost/t10')) +# => # +tag = a2.getTag +# => "archery" + +a3 = LD4L::OpenAnnotationRDF::SemanticTagAnnotation.resume(RDF::URI('http://localhost/st10')) +# => # +term = a2.getTerm +# => # +``` + *Resume annotation of unknown type.* ``` ## Using RDF::URI # Create the annotations first using previous examples. a1 = LD4L::OpenAnnotationRDF::Annotation.resume(RDF::URI('http://localhost/c10')) # => # +comment = a1.getComment +# => "This book is a good resource on archery technique." a2 = LD4L::OpenAnnotationRDF::Annotation.resume(RDF::URI('http://localhost/t10')) # => # +tag = a2.getTag +# => "archery" a3 = LD4L::OpenAnnotationRDF::Annotation.resume(RDF::URI('http://localhost/st10')) # => # +term = a2.getTerm +# => # ## Using string URI # Create the annotations first using previous examples. a1 = LD4L::OpenAnnotationRDF::Annotation.resume('http://localhost/c10') # => # +# => # +comment = a1.getComment a2 = LD4L::OpenAnnotationRDF::Annotation.resume('http://localhost/t10') # => # +tag = a2.getTag +# => "archery" a3 = LD4L::OpenAnnotationRDF::Annotation.resume('http://localhost/st10') # => # +term = a2.getTerm +# => # ## Using localname expanded using configured base_uri # Create the annotations first using previous examples. a1 = LD4L::OpenAnnotationRDF::Annotation.resume('c10') # => # +comment = a1.getComment +# => "This book is a good resource on archery technique." a2 = LD4L::OpenAnnotationRDF::Annotation.resume('t10') # => # +tag = a2.getTag +# => "archery" a3 = LD4L::OpenAnnotationRDF::Annotation.resume('st10') # => # +term = a2.getTerm +# => # ``` ### Configurations diff --git a/lib/ld4l/open_annotation_rdf/semantic_tag_annotation.rb b/lib/ld4l/open_annotation_rdf/semantic_tag_annotation.rb index 7d3b9be..3c1a212 100644 --- a/lib/ld4l/open_annotation_rdf/semantic_tag_annotation.rb +++ b/lib/ld4l/open_annotation_rdf/semantic_tag_annotation.rb @@ -13,6 +13,15 @@ class SemanticTagAnnotation < LD4L::OpenAnnotationRDF::Annotation # TODO: Should a semantic tag be destroyed when the last annotation referencing the term is destroyed? # TODO: What if other triples have been attached beyond the type? + ## + # Get the term URI of the semantic tag body. + # + # @return the term URI + def getTerm + # return existing body if term is unchanged + @body ? @body.rdf_subject : nil + end + ## # Set the hasBody property to the URI of the controlled vocabulary term that is the annotation and # create the semantic tag body instance identifying the term as a semantic tag annotation. diff --git a/lib/ld4l/open_annotation_rdf/version.rb b/lib/ld4l/open_annotation_rdf/version.rb index 4f117ed..8c14fdf 100644 --- a/lib/ld4l/open_annotation_rdf/version.rb +++ b/lib/ld4l/open_annotation_rdf/version.rb @@ -1,5 +1,5 @@ module LD4L module OpenAnnotationRDF - VERSION = "0.0.11" + VERSION = "0.0.12" end end