Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the SPARQL query to get the name of all graphs existing in my triplestore?

I want to get the name of all existing graphs in my Fuseki server, it should return a message with a list of all graphs name.

like image 993
user3457185 Avatar asked Aug 28 '15 15:08

user3457185


People also ask

What is named graph in SPARQL?

The name of a named graph is an IRI, which can be used to identify the graph in queries and updates. In a SPARQL query, all basic statement patterns are always matched against the default graph in the dataset, except when a GRAPH clause is involved.

How do I query using SPARQL?

A SPARQL query may specify the dataset to be used for matching by using the FROM clause and the FROM NAMED clause to describe the RDF dataset. If a query provides such a dataset description, then it is used in place of any dataset that the query service would use if no dataset description is provided in a query.

What is the result type of an SPARQL construct query?

SPARQL contains capabilities for querying required and optional graph patterns along with their conjunctions and disjunctions. SPARQL also supports extensible value testing and constraining queries by source RDF graph. The results of SPARQL queries can be results sets or RDF graphs.

What is prefix in SPARQL?

"PREFIX", however (without the "@"), is the SPARQL instruction for a declaration of a namespace prefix. It allows you to write prefixed names in queries instead of having to use full URIs everywhere. So it's a syntax convenience mechanism for shorter, easier to read (and write) queries.


2 Answers

I have tried the answer given by Joshua Taylor in Virtuoso, but got nothing.

Virtuoso console screnshot

Maybe it's different between fuseki and virtuoso. So I provide a sparql for virtuoso users who just find the answer like me.

SELECT DISTINCT ?g 
WHERE {
  GRAPH ?g { ?s ?p ?o }
}
like image 100
YJ. Yang Avatar answered Oct 01 '22 03:10

YJ. Yang


Without more context, we don't know whether you mean some additional metadata about the "name" of a graph, or what you mean exactly by "a message with a list of all graphs name", but it sounds like you might just want:

SELECT ?g 
WHERE {
  GRAPH ?g { }
}
like image 28
Joshua Taylor Avatar answered Oct 01 '22 02:10

Joshua Taylor