Converts a list of RDF statements into a Graph, and returns
it.
@method graphFromStatements

@param rdf {RDF} RDF library such as rdflib.js
@param statements {Array<Statement>}

@return {Graph}
322189
function graphFromStatements (rdf, statements) {
  let graph = rdf.graph()

  statements.forEach((st) => { graph.addStatement(st) })

  return graph
}
588022
private void createSequencesConstraintsStatements(Statements statements, Iterable<Sequence> sequences) {
		Statement statement = createUniqueConstraintStatement( SEQUENCE_NAME_PROPERTY, NodeLabel.SEQUENCE.name() );
		statements.addStatement( statement );
	}
11433
def extract_statements(self):
        

        # Look for events that have an AGENT and an AFFECTED, and get the
        # start and ending text indices for each.
        query = prefixes + """
        SELECT
            ?agent_start
            ?agent_end
            ?affected_start
            ?affected_end
        WHERE {
            ?rel role:AGENT ?agent .
            ?rel role:AFFECTED ?affected .
            ?agent lf:start ?agent_start .
            ?agent lf:end ?agent_end .
            ?affected lf:start ?affected_start .
            ?affected lf:end ?affected_end .
        }
        """
        results = self.graph.query(query)
        for res in results:
            # Make a statement for each query match
            self.extract_statement_from_query_result(res)

        # Look for events that have an AGENT and a RESULT, and get the start
        # and ending text indices for each.
        query = query.replace('role:AFFECTED', 'role:RESULT')
        results = self.graph.query(query)
        for res in results:
            # Make a statement for each query match
            self.extract_statement_from_query_result(res)
267057
def rdf_graph_from_yaml(yaml_root):
    """"""
    G = Graph()
    for top_entry in yaml_root:
        assert len(top_entry) == 1
        node = list(top_entry.keys())[0]
        build_relations(G, node, top_entry[node], None)
    return G
1123894
def create_many(self, statements):
        
        Statement = self.get_model('statement')
        Tag = self.get_model('tag')

        session = self.Session()

        create_statements = []
        create_tags = {}

        for statement in statements:

            statement_data = statement.serialize()
            tag_data = statement_data.pop('tags', [])

            statement_model_object = Statement(**statement_data)

            if not statement.search_text:
                statement_model_object.search_text = self.tagger.get_bigram_pair_string(statement.text)

            if not statement.search_in_response_to and statement.in_response_to:
                statement_model_object.search_in_response_to = self.tagger.get_bigram_pair_string(statement.in_response_to)

            new_tags = set(tag_data) - set(create_tags.keys())

            if new_tags:
                existing_tags = session.query(Tag).filter(
                    Tag.name.in_(new_tags)
                )

                for existing_tag in existing_tags:
                    create_tags[existing_tag.name] = existing_tag

            for tag_name in tag_data:
                if tag_name in create_tags:
                    tag = create_tags[tag_name]
                else:
                    # Create the tag if it does not exist
                    tag = Tag(name=tag_name)

                    create_tags[tag_name] = tag

                statement_model_object.tags.append(tag)
            create_statements.append(statement_model_object)

        session.add_all(create_statements)
        session.commit()
678046
function appendGraph (toGraph, fromGraph, docURI) {
  fromGraph.statementsMatching(ALL_STATEMENTS)
    .forEach((st) => {
      toGraph.add(st.subject, st.predicate, st.object, st.why)
    })
}
841046
function (statements) {
            for (var i = 0, len = statements.length; i < len; i += 1) {
                var statement = statements[i];
                this.STATEMENTS[statement] = this.ALLSTATEMENTS[statement];
            }
        }
1189940
@NonNull
  public BatchStatementBuilder addStatements(@NonNull BatchableStatement<?>... statements) {
    return addStatements(Arrays.asList(statements));
  }
960145
def extract_statements(self):
        """"""
        for p_info in self._json:
            para = RlimspParagraph(p_info, self.doc_id_type)
            self.statements.extend(para.get_statements())
        return
763276
@Override
    public RepositoryResult<Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred, Resource... contexts) throws RepositoryException {
        if (contexts == null) {
            contexts = new Resource[] { null };
        }
        try {
            if (isQuadMode()) {
                StringBuilder sb = new StringBuilder();
                sb.append("SELECT * WHERE { GRAPH ?ctx { ?s ?p ?o } filter (?ctx = (");
                boolean first = true;
                for (Resource context : contexts) {
                    if (first) {
                        first = !first;
                    }
                    else {
                        sb.append(",");
                    }
                    if (notNull(context)) {
                        sb.append("IRI(\"" + context.toString() + "\")");
                    } else {
                        sb.append("IRI(\""+DEFAULT_GRAPH_URI+"\")");
                    }
                }
                sb.append(") ) }");
                TupleQuery tupleQuery = prepareTupleQuery(sb.toString());
                tupleQuery.setIncludeInferred(includeInferred);
                setBindings(tupleQuery, subj, pred, obj, (Resource) null);
                TupleQueryResult qRes = tupleQuery.evaluate();
                return new RepositoryResult<Statement>(
                        new ExceptionConvertingIteration<Statement, RepositoryException>(
                                toStatementIteration(qRes, subj, pred, obj)) {
                            @Override
                            protected RepositoryException convert(Exception e) {
                                return new RepositoryException(e);
                            }
                        });
            } else if (subj != null && pred != null && obj != null) {
                if (hasStatement(subj, pred, obj, includeInferred, contexts)) {
                    Statement st = new StatementImpl(subj, pred, obj);
                    CloseableIteration<Statement, RepositoryException> cursor;
                    cursor = new SingletonIteration<Statement, RepositoryException>(st);
                    return new RepositoryResult<Statement>(cursor);
                } else {
                    return new RepositoryResult<Statement>(new EmptyIteration<Statement, RepositoryException>());
                }
            }
            else {
                MarkLogicGraphQuery query = prepareGraphQuery(EVERYTHING);
                setBindings(query, subj, pred, obj, contexts);
                GraphQueryResult result = query.evaluate();
                return new RepositoryResult<Statement>(
                        new ExceptionConvertingIteration<Statement, RepositoryException>(result) {
                            @Override
                            protected RepositoryException convert(Exception e) {
                                return new RepositoryException(e);
                            }
                        });
            }
        } catch (MalformedQueryException e) {
            throw new RepositoryException(e);
        } catch (QueryEvaluationException e) {
            throw new RepositoryException(e);
        }
    }
364191
def nt(graph):
    """"""
    from rdflib import ConjunctiveGraph
    from rdflib.plugin import register, Parser

    register('json-ld', Parser, 'rdflib_jsonld.parser', 'JsonLDParser')

    click.echo(
        ConjunctiveGraph().parse(
            data=_jsonld(graph, 'expand'),
            format='json-ld',
        ).serialize(format='nt')
    )
99752
function interpretStatements(statements) {
    var /** @type {?} */ ctx = new _ExecutionContext(null, null, null, new Map());
    var /** @type {?} */ visitor = new StatementInterpreter();
    visitor.visitAllStatements(statements, ctx);
    var /** @type {?} */ result = {};
    ctx.exports.forEach(function (exportName) { result[exportName] = ctx.vars.get(exportName); });
    return result;
}
462681
def read_data
      @statements_by_subject = {}

      @edges_by_subject = {}

      RDF::NTriples::Reader.new(@data) do |reader|
        reader.each_statement do |statement|
          subject = statement.subject.to_s

          Grom::Helper.lazy_array_insert(@statements_by_subject, subject, statement)

          predicate = statement.predicate.to_s

          object_is_possible_link = statement.object.uri? || statement.object.is_a?(RDF::Node)
          predicate_is_not_a_type_definition = predicate != RDF.type.to_s

          if object_is_possible_link && predicate_is_not_a_type_definition
            predicate = Grom::Helper.get_id(predicate)
            @edges_by_subject[subject] ||= {}
            @edges_by_subject[subject][predicate] ||= []
            @edges_by_subject[subject][predicate] << statement.object.to_s
          end
        end
      end

      self
    end
1153717
function Graph(directed) {
  this.directed = (directed === undefined ? true : !!directed);
  this.adjList = Object.create(null);
  this.vertices = new HashSet();
}
167258
function getGraphQLValue(value) {
      if ("string" === typeof value) {
        value = JSON.stringify(value);
      } else if (Array.isArray(value)) {
        value = value.map(item => {
            return getGraphQLValue(item);
            }).join();
        value = `[${value}]`;
      } else if ("object" === typeof value) {
      /*if (value.toSource)
            value = value.toSource().slice(2,-2);
        else*/
            value = objectToString(value);
            //console.error("No toSource!!",value);
      }
      return value;
}
953175
public static List<Statement> getStatements(Nanopub nanopub) {
		List<Statement> s = new ArrayList<>();
		s.addAll(getSortedList(nanopub.getHead()));
		s.addAll(getSortedList(nanopub.getAssertion()));
		s.addAll(getSortedList(nanopub.getProvenance()));
		s.addAll(getSortedList(nanopub.getPubinfo()));
		return s;
	}
593076
def _construct_query_for_uris_and_graphs(uris_and_graphs)
      value_pairs = uris_and_graphs.map do |(uri, graph)|
        u = RDF::URI.new(uri).to_base
        g = graph ? RDF::URI.new(graph).to_base : 'UNDEF'
        "(#{u} #{g})"
      end
      query = "CONSTRUCT { ?uri ?p ?o . #{ self.all_triples_construct("?uri") }} WHERE { GRAPH ?g { ?uri ?p ?o . #{ self.all_triples_where("?uri") } VALUES (?uri ?g) { #{ value_pairs.join(' ') } } } }"
    end