This code is equivalent to the SPARQL query below.

<p><pre><code>
SELECT ?subject ?predicate ?object
WHERE { GRAPH fromGraphName { ?subject ?predicate ?object } }
</code></pre>
337009
private Stream<Quad> fetchAllFromGraph(final String fromGraphName, final IRI toGraphName) {
        final Query q = new Query();
        q.setQuerySelectType();
        q.addResultVar(SUBJECT);
        q.addResultVar(PREDICATE);
        q.addResultVar(OBJECT);

        final ElementPathBlock epb = new ElementPathBlock();
        epb.addTriple(create(SUBJECT, PREDICATE, OBJECT));

        final ElementGroup elg = new ElementGroup();
        elg.addElement(new ElementNamedGraph(createURI(fromGraphName), epb));

        q.setQueryPattern(elg);

        final Stream.Builder<Quad> builder = builder();
        rdfConnection.querySelect(q, qs -> builder.accept(rdf.createQuad(toGraphName,
                        getSubject(qs), getPredicate(qs), getObject(qs))));
        return builder.build();
    }
686536
@Override
    public Object find(Class entityClass, Object key)
    {
        GraphDatabaseService graphDb = null;
        if (resource != null)
        {
            graphDb = getConnection();
        }

        if (graphDb == null)
            graphDb = factory.getConnection();

        EntityMetadata m = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClass);

        Object entity = null;
        Node node = mapper.searchNode(key, m, graphDb, true);

        if (node != null && !((Neo4JTransaction) resource).containsNodeId(node.getId()))

        {
            entity = getEntityWithAssociationFromNode(m, node);
        }

        return entity;
    }
829240
public Object visit(QueryRootNode node, Object data) throws RepositoryException {
        StringBuilder sb = (StringBuilder) data;
        try {
            sb.append("SELECT");

            InternalQName[] selectProps = node.getSelectProperties();
            if (selectProps.length == 0) {
                sb.append(" *");
            } else {
                String comma = "";
                for (int i = 0; i < selectProps.length; i++) {
                    sb.append(comma).append(" ");
                    appendName(selectProps[i], resolver, sb);
                    comma = ",";
                }
            }

            sb.append(" FROM");

            // node type restrictions are within predicates of location nodes
            // therefore we write the where clause first to a temp string to
            // collect the node types.
            StringBuilder tmp = new StringBuilder();
            LocationStepQueryNode[] steps = node.getLocationNode().getPathSteps();
            QueryNode[] predicates = steps[steps.length - 1].getPredicates();
            // are there any relevant predicates?
            for (int i = 0; i < predicates.length; i++) {
                if (predicates[i].getType() != QueryNode.TYPE_NODETYPE) {
                    tmp.append(" WHERE ");
                }
            }
            String and = "";
            for (int i = 0; i < predicates.length; i++) {
                if (predicates[i].getType() != QueryNode.TYPE_NODETYPE) {
                    tmp.append(and);
                    and = " AND ";
                }
                predicates[i].accept(this, tmp);
            }

            // node types have been collected by now
            String comma = "";
            int ntCount = 0;
            for (Iterator<InternalQName> it = nodeTypes.iterator(); it.hasNext(); ntCount++) {
               InternalQName nt = it.next();
                sb.append(comma).append(" ");
                appendName(nt, resolver, sb);
                comma = ",";
            }

            if (ntCount == 0) {
                sb.append(" ");
                sb.append(resolver.createJCRName(Constants.NT_BASE).getAsString());
            }

            // append WHERE clause
            sb.append(tmp.toString());

            if (steps.length == 2
                    && steps[1].getIncludeDescendants()
                    && steps[1].getNameTest() == null) {
                // then this query selects all paths
            } else if (steps.length == 1
                    && steps[0].getIncludeDescendants()
                    && steps[0].getNameTest() == null) {
                // then this query selects all paths
            } else {
                if (predicates.length > 0) {
                    sb.append(" AND ");
                } else {
                    sb.append(" WHERE ");
                }
                node.getLocationNode().accept(this, sb);
            }
        } catch (NamespaceException e) {
            exceptions.add(e);
        }

        if (node.getOrderNode() != null) {
            node.getOrderNode().accept(this, sb);
        }

        return sb;
    }
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
950430
public static Parser<Relation> query() {
    Parser.Reference<Relation> relationRef = Parser.newReference();
    Parser<Relation> subQuery = ExpressionParser.paren(relationRef.lazy());
    Parser.Reference<Expression> conditionRef = Parser.newReference();
    Parser<Expression> expr = ExpressionParser.expression(conditionRef.lazy());
    Parser<Expression> cond = ExpressionParser.condition(expr, subQuery);
    Parser<Relation> relation = query(expr, cond, subQuery.or(TABLE));
    conditionRef.set(cond);
    relationRef.set(relation);
    return relation;
  }
593022
private SimpleGraphResultSet executeDescribeQuery(DescribeQuery inputQuery)
			throws OntopReformulationException, OntopResultConversionException, OntopConnectionException,
			OntopQueryEvaluationException {

		ImmutableSet<String> constants = extractDescribeQueryConstants(inputQuery);

		SimpleGraphResultSet describeResultSet = null;

		try {
			// execute describe <uriconst> in subject position
			for (String constant : constants) {
				// for each constant we execute a construct with
				// the uri as subject, and collect the results
				String str = SPARQLQueryUtility.getConstructSubjQuery(constant);
				ConstructQuery constructQuery = inputQueryFactory.createConstructQuery(str);

				SimpleGraphResultSet set = executeInThread(constructQuery, this::executeDescribeConstructQuery);
				if (describeResultSet == null) { // just for the first time
					describeResultSet = set;
				} else if (set != null) {
					// 2nd and manyth times execute, but collect result into one object
					while (set.hasNext())
						describeResultSet.addNewResult(set.next());
				}
			}
			// execute describe <uriconst> in object position
			for (String constant : constants) {
				String str = SPARQLQueryUtility.getConstructObjQuery(constant);

				ConstructQuery constructQuery = inputQueryFactory.createConstructQuery(str);
				SimpleGraphResultSet set = executeInThread(constructQuery, this::executeDescribeConstructQuery);

				if (describeResultSet == null) { // just for the first time
					describeResultSet = set;
				} else if (set != null) {
					while (set.hasNext())
						describeResultSet.addNewResult(set.next());
				}
			}
			// Exception is re-cast because not due to the initial input query
		} catch (OntopInvalidInputQueryException e) {
			throw new OntopReformulationException(e);
		}
		return describeResultSet;
	}
1069334
function(h_subjects, b_raw) {

			// initiliaze output
			var s_out = '';

			// add slot for tail
			var s_tail = '';

			// newline + indent
			var _ = '\n\t'+(b_raw? '\t':'');

			// root nodes must be subjects
			for(var s_rs in h_subjects) {

				//
				var z_predicates = h_subjects[s_rs];

				// declaring optional block
				if(s_rs == '?') {

					// these are subjects actually
					var h_write = query_hash(z_predicates, true);
					s_out += _+'OPTIONAL {'+h_write.where+_+'}';
					s_tail += h_write.tail;
				}

				// regular query hash
				else {

					var s_rsi = rdf_var(s_rs);

					// this is subject
					s_out += _+s_rsi;

					// predicates are in hash
					if(typeof z_predicates == 'object') {

						// recurse
						var a_write = build_from_ph(z_predicates, _);
						s_out += a_write[0]+' .';
						s_tail += a_write[1];
					}
				}
			}

			var h_raw = {
				treated_vars: {subs:{},lists:{}},
				select: '',
				where: s_out,
				tail: s_tail,
				group: '',
				order: '',
				limit: '',
			};

			return (b_raw? h_raw: qb(h_raw));
		}
615976
@Override
    public OntModel getGraph(URI graphUri) {
        log.debug("Obtaining graph: {}", graphUri.toASCIIString());

        if (graphUri == null)
            return null;

        // FIXME: For now Jena and Sesame can't talk to each other
        // Jena will ignore a named graph as the output.
        // Use HTTP protocol if possible
//        if (this.sparqlServiceEndpoint != null) {
//            Model model = datasetAccessor.getModel(graphUri);
//            return ModelFactory.createOntologyModel(this.modelSpec, model);
//
//        } else {
        return this.getGraphSparqlQuery(graphUri);
//        }
    }
156167
@Override
    public void putGraph(Model data) {

        if (data == null)
            return;

        // Use HTTP protocol if possible
        if (this.sparqlServiceEndpoint != null) {
            datasetAccessor.putModel(data);
        } else {
            this.putGraphSparqlQuery(data);
        }

    }
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;
}
489168
def build_node_graph_data_search(key: str, data_predicate: Callable[[Any], bool]):  # noqa: D202
    

    def node_data_filter(graph: BELGraph, node: BaseEntity) -> bool:
        """Pass if the given node has a given data annotated and passes the contained filter."""
        value = graph.nodes[node].get(key)
        return value is not None and data_predicate(value)

    return node_data_filter
424176
def where(filter)
      if filter.is_a?(String) # we got a Sparql snippet
        where_clauses << filter
      elsif filter.is_a?(Hash)
        filter.each_pair do |key, value|
          field = resource_class.get_field(key)
          value = RDF::Literal.new(value) unless value.respond_to?(:to_base)
          where_clauses << "?uri <#{ field.predicate }> #{ value.to_base }"
        end
      end
      self
    end
1055314
def canned_query(n,s):
    
    qobj = qmap[n]
    chain = qobj['chain']
    prefix = qobj['prefix']
    whr = chain2where(chain + [prefix], 'x')
    query = """
    SELECT * WHERE {{
    <{s}> {w}
    }}
    """.format(s=s, w=whr)
    bindings = run_sparql(query)
    rows = [ensure_prefixed(r['x']['value'], prefix) for r in bindings]
    return rows
322189
function graphFromStatements (rdf, statements) {
  let graph = rdf.graph()

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

  return graph
}
1314783
def get_nodes(graph: BELGraph, node_predicates: NodePredicates) -> Set[BaseEntity]:
    """"""
    return set(filter_nodes(graph, node_predicates=node_predicates))
554146
public <T> JDOQuery<T> selectFrom(EntityPath<T> expr) {
        return select(expr).from(expr);
    }
1335580
def sparql(self, stringa):
        
        qres = self.rdfgraph.query(stringa)
        return list(qres)