Module: OpenAnnotationHarvest
- Defined in:
- lib/annotations2triannon/open_annotation_harvest.rb
Overview
Module designed to be a mixin for manifest and annotation list.
Instance Method Summary collapse
-
#collect_open_annotations(rdf) ⇒ Array<RDF::Graph>
For graphs of type RDF::Vocab::OA.Annotation.
-
#rdf_expand_blank_nodes(object) ⇒ RDF::Graph
Graph of recursive resolution for a blank node.
Instance Method Details
#collect_open_annotations(rdf) ⇒ Array<RDF::Graph>
Returns for graphs of type RDF::Vocab::OA.Annotation.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/annotations2triannon/open_annotation_harvest.rb', line 9 def collect_open_annotations(rdf) oa_graphs = [] q = [nil, RDF.type, RDF::Vocab::OA.Annotation] rdf.query(q).each_subject do |subject| g = RDF::Graph.new rdf.query([subject, nil, nil]) do |s,p,o| g << [s,p,o] g << (o) if o.node? end oa_graphs << g end oa_graphs end |
#rdf_expand_blank_nodes(object) ⇒ RDF::Graph
Returns graph of recursive resolution for a blank node.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/annotations2triannon/open_annotation_harvest.rb', line 25 def (object) g = RDF::Graph.new if object.node? rdf.query([object, nil, nil]) do |s,p,o| g << [s,p,o] g << (o) if o.node? end end g end |