Listing all the namedGraph

6 views
Skip to first unread message

Busa

unread,
Jun 26, 2009, 3:21:09 AM6/26/09
to OpenAnzo
Hi Anzo,
I have another question about Command Interface. Is there a way to
list all the namedGraph stored in Anzo?

Thx,
Busa,

Lee Feigenbaum

unread,
Jun 26, 2009, 9:22:47 AM6/26/09
to open...@googlegroups.com
Hi Busa,

There's not a direct command to do this - one of several ways to do it
is via a SPARQL query:

anzo query -A "SELECT DISTINCT ?graph { GRAPH ?graph { [] ?p [] } }"

Lee
--
Lee Feigenbaum
VP Technology & Standards, Cambridge Semantics Inc
l...@cambridgesemantics.com
1-617-553-1060

Busa

unread,
Jun 26, 2009, 10:26:28 AM6/26/09
to OpenAnzo
Ok. Thx! ;)

Andy

unread,
Jul 8, 2009, 2:36:30 PM7/8/09
to OpenAnzo
When I run this query on my Anzo installation it reports a bunch of
graphs like:

http://openanzo.org/registries/SemanticService
http://openanzo.org/registries/SemanticService
http://openanzo.org/registries/SemanticService
http://openanzo.org/registries/SemanticService
http://openanzo.org/semanticServices/datasources
http://openanzo.org/semanticServices/datasources
http://openanzo.org/semanticServices/datasources
http://openanzo.org/semanticServices/datasources
http://openanzo.org/semanticServices/datasources
http://openanzo.org/semanticServices/datasources
http://openanzo.org/semanticServices/datasources
http://openanzo.org/semanticServices/datasources
http://openanzo.org/semanticServices/datasources
http://openanzo.org/semanticServices/datasources
http://openanzo.org/semanticServices/echoService
http://openanzo.org/semanticServices/echoService
http://openanzo.org/semanticServices/echoService
http://openanzo.org/semanticServices/echoService
http://openanzo.org/semanticServices/echoService
http://openanzo.org/semanticServices/echoService
http://openanzo.org/semanticServices/echoService
http://openanzo.org/semanticServices/echoService
http://openanzo.org/semanticServices/echoService
http://openanzo.org/semanticServices/echoService
http://openanzo.org/semanticServices/echoService
http://openanzo.org/semanticServices/echoService
http://openanzo.org/semanticServices/echoService
http://openanzo.org/semanticServices/echoService

now that seems odd since the query used "DISTINCT" and there are
obviously duplicates in the list? I cannot see anything in the SPARQL
specification that says "DISTINCT" would not apply in this case.

I have been looking at the SPARQL specification and I have not figured
out a way that you can get rid of the items in the list that <b>start
with</b> "http://openanzo.org/" so only my graphs appear. Anybody
have a suggestion on how I can do that? Also, why do you need -A on
the command line to get this query to work. Looking at the anzo query
help it says: "Query against a dataset composed of all named graphs in
the repository". Maybe I missed something in the SPARQL
specification, but doesn't the GRAPH keyword in the query do that?

On Jun 26, 9:22 am, Lee Feigenbaum <l...@cambridgesemantics.com>
wrote:

Lee Feigenbaum

unread,
Jul 8, 2009, 4:04:23 PM7/8/09
to open...@googlegroups.com
When I run the same query against a fresh Open Anzo install I get:

>anzo query -A "SELECT DISTINCT ?graph { GRAPH ?graph { [] ?p [] } }"

?graph
--------------------------------------------------
datasource:systemDatasource
http://openanzo.org/internal/osgi
http://openanzo.org/namedGraphs/defaultSystemGraph
oareg:Datasources
oareg:SemanticService
http://openanzo.org/semanticServices/datasources
http://openanzo.org/semanticServices/echoService

It's possible that a bug's been fixed since the version you downloaded,
Andy, so I'd recommend refreshing to the latest nightly distribution.

> I have been looking at the SPARQL specification and I have not figured
> out a way that you can get rid of the items in the list that <b>start
> with</b> "http://openanzo.org/" so only my graphs appear. Anybody
> have a suggestion on how I can do that?

Sure. You can use the built-in SPARQL regex filter to do this. Something
like:

SELECT DISTINCT ?graph {
GRAPH ?graph {
[] ?p []
}
FILTER(!regex(str(?graph), 'openanzo.org'))
}

> Also, why do you need -A on
> the command line to get this query to work. Looking at the anzo query
> help it says: "Query against a dataset composed of all named graphs in
> the repository". Maybe I missed something in the SPARQL
> specification, but doesn't the GRAPH keyword in the query do that?

No, GRAPH simply scopes part of the query to the named graph portion of
the RDF dataset in effect. You still need to tell the query engine what
should go in the named graph portion of the RDF dataset. This can be
accomplished via FROM NAMED clauses, via the SPARQL protocol
named-graph-uri parameter, or via an API. In the case of the Open Anzo
CLI, the -A flag says "include every graph you know about as a named
graph in the query's RDF dataset".

Some SPARQL implementations default to this behavior when querying
against an unspecified RDF dataset. Glitter (Open Anzo's SPARQL engine)
simply defaults to querying against an empty RDF dataset if nothing is
specified.

Lee
Reply all
Reply to author
Forward
0 new messages