# \--named-graph vs FROM different results (prefix not respected in --named-graph CLI param)

**URL:** <https://community.stardog.com/t/named-graph-vs-from-different-results-prefix-not-respected-in-named-graph-cli-param/1066>\
**Category:** Support\
**Created:** [May 25, 2018, 9:11am UTC](https://community.stardog.com/t/named-graph-vs-from-different-results-prefix-not-respected-in-named-graph-cli-param/1066 "2018-05-25T09:11:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rivettp](https://avatars.discourse-cdn.com/v4/letter/r/82dd89/32.png) [@rivettp](https://community.stardog.com/u/rivettp)\
**Post date:** [May 25, 2018, 9:11am UTC](https://community.stardog.com/t/named-graph-vs-from-different-results-prefix-not-respected-in-named-graph-cli-param/1066/1 "2018-05-25T09:11:11Z")

</div>

I’m sure this is something stupid I’ve done but I’m tearing my hair out on this…  
I loaded some data:  
stardog data add --named-graph repos:fibo FIBO.zip  
and got confirmation of 70k triples loaded  
If I then do the following I get the results expected:  
stardog query execute --named-graph repos:fibo “select \* where {?s ?p ?o} limit 10”  
If however I use FROM instead of --named-graph I get nothing:  
stardog query execute “select \* from repos:fibo where {?s ?p ?o} limit 10”  
The prefix repos is defined in the database as:  
repos=http://com.adaptive.repository/

---

<div class="post-metadata">

**Author:** ![lorenz\_b](https://avatars.discourse-cdn.com/v4/letter/l/d78d45/32.png) [@lorenz\_b](https://community.stardog.com/u/lorenz_b)\
**Post date:** [May 25, 2018, 9:43am UTC](https://community.stardog.com/t/named-graph-vs-from-different-results-prefix-not-respected-in-named-graph-cli-param/1066/2 "2018-05-25T09:43:51Z")

</div>

Shouldn’t you use `FROM NAMED` then?

---

<div class="post-metadata">

**Author:** ![pavel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/pavel/32/18_2.png) [@pavel](https://community.stardog.com/u/pavel)\
**Post date:** [May 25, 2018, 9:49am UTC](https://community.stardog.com/t/named-graph-vs-from-different-results-prefix-not-respected-in-named-graph-cli-param/1066/3 "2018-05-25T09:49:06Z")

</div>

No, FROM is correct since the pattern is in the default scope.

Pete, what’s the output of `select distinct ?g { graph ?g { ?s ?p ?o } }` or even `select ?g (count(*) as ?c) { graph ?g { ?s ?p ?o } } group by ?g`?  
I suspect some IRI mismatch…

Cheers,  
Pavel

---

<div class="post-metadata">

**Author:** ![rivettp](https://avatars.discourse-cdn.com/v4/letter/r/82dd89/32.png) [@rivettp](https://community.stardog.com/u/rivettp)\
**Post date:** [May 25, 2018, 9:52am UTC](https://community.stardog.com/t/named-graph-vs-from-different-results-prefix-not-respected-in-named-graph-cli-param/1066/4 "2018-05-25T09:52:39Z")

</div>

OK I answered my own question. The problem is that the --named-graph parameter in the CLI does not respect the prefix defined in the database, so that the data was loaded into graph "repos:fibo" not "[http://com.adaptive.repository/fibo](http://com.adaptive.repository/fibo)". If I query using the following I get the results:  
` select * from <repos:fibo> where {?s ?p ?o}`  
then I get the results.

Can this problem be considered a bug? Is it not reasonable to expect the prefixes to be honored? This behavior should at least be documented in the man pages for the CLI.  
Personally I would like the prefix to be honored: we have shell scripts for various loading tasks and we don't want to have to edit them all if we happen to change how the prefixes are mapped to URIs in the database - the prefixes are a useful level of indirection.

---

<div class="post-metadata">

**Author:** ![evren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/evren/32/1515_2.png) [@evren](https://community.stardog.com/u/evren)\
**Post date:** [May 25, 2018, 1:03pm UTC](https://community.stardog.com/t/named-graph-vs-from-different-results-prefix-not-respected-in-named-graph-cli-param/1066/5 "2018-05-25T13:03:14Z")

</div>

Hi Pete,

I agree that it would be useful if the CLI recognized the prefixes stored in the database. We will fix this in the next release.

Best,  
Evren

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [June 8, 2018, 1:03pm UTC](https://community.stardog.com/t/named-graph-vs-from-different-results-prefix-not-respected-in-named-graph-cli-param/1066/6 "2018-06-08T13:03:16Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
