Re: [stardog-users] How to specify the default graph in a FROM clause

23 views
Skip to first unread message

Kendall Clark

unread,
Jun 7, 2013, 12:27:43 PM6/7/13
to stardog
From the documentation,

The legal value of reasoning.schema.graphs is a list of named graph identifiers, including (optionally) the special names, tag:stardog:api:context:default and tag:stardog:api:context:all, which represent the default graph and the union of all named graphs and the default graph, respectively. In the context of database configurations only, Stardog will recognize default and * as shorter forms of those URIs, respectively.

Cheers,
Kendall


On Fri, Jun 7, 2013 at 12:20 PM, Todd DeLuca <toddd...@gmail.com> wrote:

I am having a problem where I would like to query a named graph and a default graph at the same time, but specifying 'FROM' or 'FROM NAMED' in my SPARQL query seems to make all the triples in the default stardog graph disappear.  I imagine the solution is to include the URI for the default stardog graph in the query, but I cannot find the URI.  I have tried <DEFAULT> and <default> to no avail.  Can someone tell me the IRI of the default graph in my stardog database?  Or can they tell me the right way to do this if I am going about this the wrong way?  Below is a simple example query and the real query for what I want to do.

I have some triples in the default graph and some triples in two named graphs, call them 'http://muscle' and 'http://cns'.  I would like to query using the default graph and one of the named graphs, like:

SELECT *
FROM <DEFAULT>
FROM NAMED <http://muscle>
WHERE {
  GRAPH <http://muscle> {
      ?a <affects> <target> .
  }
  ?b <related_to> ?a .
}

The actual query is:

    SELECT DISTINCT ?gene
    WHERE {
    # focus on a specific tissue screen
        # drosophila mirbase ids regulating affy ids
        ?mid ex:regulates ?affy .
        ?mid up:organism taxon:7227 .
        ?mid up:database db:mirbase_id .
        ?affy up:database db:affymetrix_probeset
    }
    # flybase genes mapping to the affy ids
    ?affy rdfs:seeAlso ?gene .
    ?gene up:database db:flybase_gene .
    # map from original mirbase id to all possible mirbase ids for the mature
    # mirbase accession.
    ?macc mb:has_id ?mid .
    ?macc a mb:mature_mirna .
    }

Thank you for any help you can give.

Regards,
Todd

--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en
 
 

Todd DeLuca

unread,
Jun 7, 2013, 12:35:17 PM6/7/13
to sta...@clarkparsia.com
That worked like a charm.  Thanks so much!  

Amin Tajgardoon

unread,
Aug 19, 2014, 9:13:27 AM8/19/14
to sta...@clarkparsia.com, toddd...@gmail.com
What should I use in a query to specify all database contexts? FROM <ALL> ?

Evren Sirin

unread,
Aug 19, 2014, 9:20:22 AM8/19/14
to Stardog, toddd...@gmail.com
You can use FROM <tag:stardog:api:context:all>. If you always want to
query all contexts then you can set query.all.graphs=true in
stardog.properties in your STARDOG_HOME directory [1] and query
without any FROM clause.

Best,
Evren

[1] http://docs.stardog.com/admin/#sd-Server-Admin
Reply all
Reply to author
Forward
0 new messages