Push an RDF::Statement into the object

 @param [RDF::Statement, Hash, Array] statement @see RDF::Statement#from
 @return [Object, nil] the value inserted into the object
540313
def <<(statement)
      # ActiveTriples::Resource expects: RDF::Statement, Hash, or Array
      statement = RDF::Statement.from(statement) unless statement.is_a? RDF::Statement

      # Only push statement if the statement's predicate is defined on the class
      field_name = field_from_predicate(statement.predicate)
      return unless field_name

      objects = statement.object.is_a?(RDF::Node) && block_given? ? yield : statement.object

      update_field(field_name, *objects) if fields[field_name]
      update_relation(field_name, *objects) if relations[field_name]
    end
1215790
def create(self, **kwargs):
        
        Statement = self.get_model('statement')
        Tag = self.get_model('tag')

        session = self.Session()

        tags = set(kwargs.pop('tags', []))

        if 'search_text' not in kwargs:
            kwargs['search_text'] = self.tagger.get_bigram_pair_string(kwargs['text'])

        if 'search_in_response_to' not in kwargs:
            in_response_to = kwargs.get('in_response_to')
            if in_response_to:
                kwargs['search_in_response_to'] = self.tagger.get_bigram_pair_string(in_response_to)

        statement = Statement(**kwargs)

        for tag_name in tags:
            tag = session.query(Tag).filter_by(name=tag_name).first()

            if not tag:
                # Create the tag
                tag = Tag(name=tag_name)

            statement.tags.append(tag)

        session.add(statement)

        session.flush()

        session.refresh(statement)

        statement_object = self.model_to_object(statement)

        self._session_finish(session)

        return statement_object
518673
def create_statement(self, connection_id):
        
        request = requests_pb2.CreateStatementRequest()
        request.connection_id = connection_id

        response_data = self._apply(request)
        response = responses_pb2.CreateStatementResponse()
        response.ParseFromString(response_data)
        return response.statement_id
834441
public T withStatement(Statement statement) {
		PropertyIdValue pid = statement.getMainSnak()
				.getPropertyId();
		ArrayList<Statement> pidStatements = this.statements.get(pid);
		if (pidStatements == null) {
			pidStatements = new ArrayList<Statement>();
			this.statements.put(pid, pidStatements);
		}

		pidStatements.add(statement);
		return getThis();
	}
445787
def add_statement(self, line: str, lineno: Optional[int] = None) -> None:
        ''''''
        # there can be only one statement block
        if self.category() != 'statements':
            self.values = [line]
        else:
            self.values.append(line)
        if self.statements and self.statements[-1][0] == '!':
            self.statements[-1][-1] += line
        else:
            self.statements.append(['!', line])
        if lineno:
            self.lineno = lineno
812589
def object
      if instance_variable_defined?(:@object)
        @object
      else
        rdf_node = Redland.librdf_statement_get_object(rdf_statement)
        @object = rdf_node.null? ? nil : Node.new(rdf_node)
      end
    end
306317
void writeStatementRankTriple(Resource subject, StatementRank rank) {
		try {
			this.rdfWriter.writeTripleUriObject(subject, RdfWriter.WB_RANK,
					getUriStringForRank(rank));
			this.rankBuffer.add(rank, subject);

		} catch (RDFHandlerException e) {
			throw new RuntimeException(e.getMessage(), e);
		}
	}
258999
public function enqueueStatement(CNabuDBAbstractStatement $statement)
    {
        if ($statement instanceof CMySQLStatement) {
            $hash = $statement->getHash();
            if (!is_array($this->statements) || count($this->statements) === 0) {
                $this->statements = array($hash => $statement);
            } else {
                $this->statements[$hash] = $statement;
            }
        }
    }
489338
def _parse_block(self, block, node):
        '''
        
        '''
        assert block[self.get_key()] == 'Block'

        if self.is_compact_ast:
            statements = block['statements']
        else:
            statements = block[self.get_children('children')]

        for statement in statements:
            node = self._parse_statement(statement, node)
        return node
157645
def select_values(statement, build_arg = nil)
    select(statement, build_arg).collect { |row| row.values }
  end
1104663
def statement(type, hook, opt={})
      lang = opt[:lang] || Cog.active_language
      lang.comment_pattern("#{type}\\s*:\\s*(#{hook})\\s*(?:\\(\\s*(.+?)\\s*\\))?(\\s*once\\s*)?(?:\\s*([{]))?")
    end
1283011
def create_many(self, statements):
        
        create_statements = []

        for statement in statements:
            statement_data = statement.serialize()
            tag_data = list(set(statement_data.pop('tags', [])))
            statement_data['tags'] = tag_data

            if not statement.search_text:
                statement_data['search_text'] = self.tagger.get_bigram_pair_string(statement.text)

            if not statement.search_in_response_to and statement.in_response_to:
                statement_data['search_in_response_to'] = self.tagger.get_bigram_pair_string(statement.in_response_to)

            create_statements.append(statement_data)

        self.statements.insert_many(create_statements)
1137245
def get_statements(subject: nil)
      raise(TriplestoreAdapter::TriplestoreException, "get_statements received blank subject") if subject.empty?
      subject = URI.escape(subject.to_s)
      uri = URI.parse(format("%{uri}?GETSTMTS&s=<%{subject}>&includeInferred=false", {uri: @uri, subject: subject}))
      request = Net::HTTP::Get.new(uri)
      response = @http.request(uri, request)
      RDF::Reader.for(:ntriples).new(response.body)
    end
1173573
def snap
      serialize_attribute = lambda do |attribute| 
        # If a proc, do nothing, cannot be serialized
        # XXX: raise warning on passing in a proc?
        if attribute.is_a? Proc
          # noop
         
        # Is an ActiveRecord, serialize as hash instead of serializing the object
        elsif attribute.class.ancestors.include?(ActiveRecord::Base)            
          attribute.serializable_hash

        # If an array, such as from an association, serialize the elements in the array
        elsif attribute.is_a?(Array) || attribute.is_a?(ActiveRecord::Associations::CollectionProxy)
          attribute.map { |element| serialize_attribute.call(element) }

        # otherwise, return val
        else
          attribute
        end
      end

      {}.tap do |s|
        self.class.audited_attributes.each do |attr|
          val = self.send attr
          s[attr.to_s] = serialize_attribute.call(val)
        end
      end
    end
29183
def from_hash(hash:, klass:, use_alias: false)
      validate_class_kit(klass)

      return hash.map { |i| from_hash(hash: i, klass: klass, use_alias: use_alias) } if hash.is_a?(Array)

      @hash_helper.indifferent!(hash)
      entity = klass.new
      attributes = @attribute_helper.get_attributes(klass)
      attributes.each do |attribute|
        key = use_alias ? (attribute[:alias] || attribute[:name]) : attribute[:name]
        type = attribute[:type]

        # if the hash value is nil skip it
        next if hash[key].nil?

        value = if is_class_kit?(type)
                  from_hash(hash: hash[key], klass: type, use_alias: use_alias)
                elsif type == Array
                  hash[key].map do |array_element|
                    if attribute[:collection_type].nil?
                      array_element
                    else
                      if is_class_kit?(attribute[:collection_type])
                        from_hash(hash: array_element, klass: attribute[:collection_type], use_alias: use_alias)
                      else
                        @value_helper.parse(type: attribute[:collection_type], value: array_element)
                      end
                    end
                  end
                else
                  hash[key]
                end

        entity.public_send(:"#{attribute[:name]}=", value)
      end

      entity
    end
881899
@Override
    public void removedStatement(final Statement s) {
        if (Operation.REMOVE == statements.get(s)) {
            return;
        }
        try {
            // if it's not about the right kind of node, ignore it.
            final Resource subject = s.getSubject();
            validateSubject(subject);
            LOGGER.trace(">> removing statement {}", s);

            final FedoraResource resource = idTranslator.convert(subject);
            final FedoraResource description = resource.getDescription();

            // special logic for handling rdf:type updates.
            // if the object is an already-existing mixin, update
            // the node's mixins. If it isn't, just treat it normally.
            final Property property = s.getPredicate();
            final RDFNode objectNode = s.getObject();

            if (property.equals(RDF.type) && objectNode.isResource()) {
                final Resource mixinResource = objectNode.asResource();
                jcrRdfTools.removeMixin(description, mixinResource, s.getModel().getNsPrefixMap());
                statements.put(s, Operation.REMOVE);
                return;
            }

            jcrRdfTools.removeProperty(description, property, objectNode, s.getModel().getNsPrefixMap());
            statements.put(s, Operation.REMOVE);
        } catch (final ConstraintViolationException e) {
            throw e;
        } catch (final RepositoryException | RepositoryRuntimeException e) {
            exceptions.add(e);
        }

    }
921899
def rdf_find_object(id)
      return nil unless rdf_valid?
      rdf.each_statement do |s|
        if s.subject == @iri.to_s
          return s.object if s.object.to_s =~ Regexp.new(id, Regexp::IGNORECASE)
        end
      end
      nil
    end