Class: Triannon::AnnotationLdp
- Inherits:
-
Object
- Object
- Triannon::AnnotationLdp
- Defined in:
- app/models/triannon/annotation_ldp.rb
Overview
an LDP aware model of an Annotation – basically, a shim between the OA notion of an annotation
and the LDP storage.
Instance Method Summary collapse
- #base_uri ⇒ Object
-
#body_uris ⇒ Array<String>
The uris of each LDP body resource.
-
#graph ⇒ Object
RDF::Graph object with all triples, including back end (e.g. LDP, Fedora).
-
#load_statements_into_graph(statements) ⇒ Object
add the passed statements to #graph.
-
#stripped_graph ⇒ Object
RDF::Graph without any back end (e.g. LDP, Fedora) triples.
-
#target_uris ⇒ Array<String>
The uris of each LDP target resource.
Instance Method Details
#base_uri ⇒ Object
16 17 18 19 |
# File 'app/models/triannon/annotation_ldp.rb', line 16 def base_uri res = graph.query Triannon::Graph.anno_query res.first.s end |
#body_uris ⇒ Array<String>
Returns the uris of each LDP body resource.
22 23 24 25 26 27 28 29 30 31 |
# File 'app/models/triannon/annotation_ldp.rb', line 22 def body_uris q = Triannon::Graph.anno_query.dup q << [:s, RDF::OpenAnnotation.hasBody, :body_uri] solns = graph.query q result = [] solns.distinct.each { |soln| result << soln.body_uri } result end |
#graph ⇒ Object
RDF::Graph object with all triples, including back end (e.g. LDP, Fedora)
7 8 9 |
# File 'app/models/triannon/annotation_ldp.rb', line 7 def graph @g ||= RDF::Graph.new end |
#load_statements_into_graph(statements) ⇒ Object
add the passed statements to #graph
47 48 49 |
# File 'app/models/triannon/annotation_ldp.rb', line 47 def load_statements_into_graph statements graph.insert(statements) if statements && statements.size > 0 end |
#stripped_graph ⇒ Object
RDF::Graph without any back end (e.g. LDP, Fedora) triples
12 13 14 |
# File 'app/models/triannon/annotation_ldp.rb', line 12 def stripped_graph RDF::LDP.remove_ldp_triples (RDF::FCRepo4.remove_fedora_triples(graph)) end |
#target_uris ⇒ Array<String>
Returns the uris of each LDP target resource.
34 35 36 37 38 39 40 41 42 43 |
# File 'app/models/triannon/annotation_ldp.rb', line 34 def target_uris q = Triannon::Graph.anno_query.dup q << [:s, RDF::OpenAnnotation.hasTarget, :target_uri] solns = graph.query q result = [] solns.distinct.each { |soln| result << soln.target_uri } result end |