# Named graph filter

**URL:** https://community.stardog.com/t/named-graph-filter/2739
**Category:** Support
**Created:** [October 5, 2020, 2:20pm UTC](https://community.stardog.com/t/named-graph-filter/2739 "2020-10-05T14:20:07Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![ajones](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/ajones/32/839_2.png) [@ajones](https://community.stardog.com/u/ajones)
#### Post date: [October 5, 2020, 2:20pm UTC](https://community.stardog.com/t/named-graph-filter/2739/1 "2020-10-05T14:20:07Z")

</div>

Do I need a specific setting in the database properties to be able to filter graphs?

this works:

```auto
select distinct *
where { 
    GRAPH ?g {
        ?s ?p ?o
        
    }
} 

```

and returns named graphs

```auto
<urn:graph:foaf>
<urn:graph:skos>

```

but when I ask for a filter for a graph on the list, it just returns nothing:

```auto
select distinct ?g
where { 
    GRAPH ?g {
        ?s ?p ?o
        
    }
    FILTER (?g=<urn:graph:foaf>)
} 

```

Any clues why? I tried the stardog studio online and it works there, but doesn't on my local version.

---

<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: [October 5, 2020, 2:23pm UTC](https://community.stardog.com/t/named-graph-filter/2739/2 "2020-10-05T14:23:38Z")

</div>

No, you shouldn't need anything. What's your Stardog version? Also please post the query plan.

Thanks,  
Pavel

---

<div class="post-metadata">

### Author: ![ajones](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/ajones/32/839_2.png) [@ajones](https://community.stardog.com/u/ajones)
#### Post date: [October 5, 2020, 2:24pm UTC](https://community.stardog.com/t/named-graph-filter/2739/3 "2020-10-05T14:24:17Z")

</div>

Server version 7.4.0

```auto
From local
Distinct [#1]
`─ Projection(?g) [#1]
   `─ Bind(<urn:graph:foaf> AS ?g) [#1]
      `─ Scan[SPOC](?s, ?p, ?o){<urn:graph:foaf>} [#1]

```

---

<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: [October 5, 2020, 4:12pm UTC](https://community.stardog.com/t/named-graph-filter/2739/4 "2020-10-05T16:12:27Z")

</div>

Thanks. We are so far unable to reproduce on a toy data with either 7.4.0 or 7.4.1 candidate. Are you able to share your dataset?

Cheers,  
Pavel

---

<div class="post-metadata">

### Author: ![ajones](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/ajones/32/839_2.png) [@ajones](https://community.stardog.com/u/ajones)
#### Post date: [October 5, 2020, 4:18pm UTC](https://community.stardog.com/t/named-graph-filter/2739/5 "2020-10-05T16:18:38Z")

</div>

I basically only have a few ontologies loaded. I loaded foaf and skos ontologies into their own named graphs, no data yet. Regardless of how I set up my database, I seem not to be able to get named graphs out. That is why I was wondering if there was some setting that was conflicting with getting named graphs out.

---

<div class="post-metadata">

### Author: ![ajones](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/ajones/32/839_2.png) [@ajones](https://community.stardog.com/u/ajones)
#### Post date: [October 5, 2020, 4:33pm UTC](https://community.stardog.com/t/named-graph-filter/2739/6 "2020-10-05T16:33:07Z")

</div>

Got it, I was using pystardog to load the database and I was using `<urn:graph:skos>` to load the data. There `<>` was causing the trouble. Removed those and it worked.

---

<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: [October 5, 2020, 4:35pm UTC](https://community.stardog.com/t/named-graph-filter/2739/7 "2020-10-05T16:35:58Z")

</div>

Ah, glad you figured it out!

Best,  
Pavel

---

<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: [October 19, 2020, 4:35pm UTC](https://community.stardog.com/t/named-graph-filter/2739/8 "2020-10-19T16:35:59Z")

</div>

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