lib/rdf/ldp/container.rb in rdf-ldp-1.0.1 vs lib/rdf/ldp/container.rb in rdf-ldp-2.1.0

- old
+ new

@@ -9,16 +9,16 @@ # supported by `#add` and `#remove`. # # Containers will throw errors when attempting to edit them in conflict with # LDP's restrictions on changing containment triples. # - # @see http://www.w3.org/TR/ldp/#dfn-linked-data-platform-container definition + # @see https://www.w3.org/TR/ldp/#dfn-linked-data-platform-container definition # of LDP Container class Container < RDFSource ## # @return [RDF::URI] uri with lexical representation - # 'http://www.w3.org/ns/ldp#Container' + # 'https://www.w3.org/ns/ldp#Container' def self.to_uri RDF::Vocab::LDP.Container end ## @@ -67,13 +67,14 @@ # # If a transaction is passed as the second argument, the additon of the # containment triple is completed when the transaction closes; otherwise it # is handled atomically. # - # @param [RDF::Term] a new member for this container - # @param transaction [RDF::Transaction] an active transaction as context for - # the addition + # @param [RDF::Term] resource + # a new member for this container + # @param transaction [RDF::Transaction] transaction + # an active transaction as context for the addition # @return [Container] self def add(resource, transaction = nil) add_containment_triple(resource.to_uri, transaction) end @@ -83,13 +84,14 @@ # # If a transaction is passed as the second argument, the removal of the # containment triple is completed when the transaction closes; otherwise it # is handled atomically. # - # @param [RDF::Term] a new member for this container - # @param transaction [RDF::Transaction] an active transaction as context for - # the removal + # @param [RDF::Term] resource + # a new member for this container + # @param transaction [RDF::Transaction] transaction + # an active transaction as context for the removal # @return [Container] self def remove(resource, transaction = nil) remove_containment_triple(resource.to_uri, transaction) end @@ -138,13 +140,15 @@ set_last_modified(transaction) # #set_last_modified handles nil case self end ## - # @param [RDF::Term] a member to be represented in the containment triple + # @param [RDF::Term] resource + # a member to be represented in the containment triple # - # @return [RDF::URI] the containment triple, with a graph_name pointing + # @return [RDF::URI] + # the containment triple, with a graph_name pointing # to `#graph` def make_containment_triple(resource) RDF::Statement(subject_uri, CONTAINS_URI, resource, graph_name: subject_uri) end @@ -198,12 +202,12 @@ end def validate_triples!(transaction) existing_triples = containment_triples.to_a - tx_containment = transaction.query(subject: subject_uri, - predicate: CONTAINS_URI) + tx_containment = transaction.query({subject: subject_uri, + predicate: CONTAINS_URI}) tx_containment.each do |statement| unless existing_triples.include?(statement) raise(Conflict, 'Attempted to write unacceptable LDP ' \ "containment-triple: #{statement}") @@ -220,10 +224,10 @@ ## # supports Patch. def validate_statements!(statements) existing_triples = containment_triples.to_a - statements.query(subject: subject_uri, predicate: CONTAINS_URI) do |st| + statements.query({subject: subject_uri, predicate: CONTAINS_URI}) do |st| existing_triples.delete(st) do raise(Conflict, 'Attempted to write unacceptable LDP ' \ "containment-triple: #{st}") end end