Module: Krikri::LDP::RdfSource
- Extended by:
- ActiveSupport::Concern
- Includes:
- Resource
- Included in:
- OriginalRecordMetadata
- Defined in:
- lib/krikri/ldp/rdf_source.rb
Overview
Adds simple LDP persistence to ActiveTriples::Resource classes
Instance Method Summary collapse
-
#get(*args) ⇒ Object
GETs the LDP resource from #rdf_subject and resets this object’s RDF::Graph to match the one returned from the LDP server.
-
#save ⇒ Object
PUTs the LDP resource named in #rdf_subject, populating it’s content (graph) from the object’s RDF::Graph.
Methods included from Resource
#delete!, #etag, #exists?, #http_head, #ldp_connection, #modified_date
Instance Method Details
#get(*args) ⇒ Object
GETs the LDP resource from #rdf_subject and resets this object’s RDF::Graph to match the one returned from the LDP server.
27 28 29 30 31 |
# File 'lib/krikri/ldp/rdf_source.rb', line 27 def get(*args) result = super reload_ldp result end |
#save ⇒ Object
Note:
this forces a (GET/#get) reload of the resource after save since the LDP endpoint may add management triples in the response.
PUTs the LDP resource named in #rdf_subject, populating it’s content (graph) from the object’s RDF::Graph.
16 17 18 19 20 |
# File 'lib/krikri/ldp/rdf_source.rb', line 16 def save(*) result = super(dump(:ttl)) get({}, true) result end |