# Federation query

**URL:** https://community.stardog.com/t/federation-query/2346
**Category:** Support
**Created:** [March 30, 2020, 5:44pm UTC](https://community.stardog.com/t/federation-query/2346 "2020-03-30T17:44:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![eliohbeich](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/eliohbeich/32/833_2.png) [@eliohbeich](https://community.stardog.com/u/eliohbeich)
#### Post date: [March 30, 2020, 5:44pm UTC](https://community.stardog.com/t/federation-query/2346/1 "2020-03-30T17:44:14Z")

</div>

Dear all,

I am trying to execute a federated query on two local TTL file using Stardog (SERVICE key work).  
However, the SPARQL endpoint is not correct.  
the following query is  
select \* where {  
Service [http://localhost:5820/exemple1/addressBookB.ttl](http://localhost:5820/exemple1/addressBookB.ttl)  
{  
?s ?f ?l  
}  
Service [http://localhost:5820/exemple1/addressBookA.ttl](http://localhost:5820/exemple1/addressBookA.ttl)  
{  
?l ?d ?e  
}  
}

the error that i have received is 'Internal Server Error'

Any advice  
Best Regards  
Elio HBEICH

---

<div class="post-metadata">

### Author: ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)
#### Post date: [March 30, 2020, 10:54pm UTC](https://community.stardog.com/t/federation-query/2346/2 "2020-03-30T22:54:33Z")

</div>

You need to reference a SPARQL endpoint in your service queries and not the files. The files you're trying to query aren't available at the urls you're references anyway but that's not really relevant here.

So you need to create to separate databases, say example1 and example2 and load them with addressBookB.ttl and addressBookA.ttl

```
$> stardog-admin db create -n example1 addressBookA.ttl
$> stardog-admin db create -n example2 addressBookB.ttl

```

Now you can query across the two databases

```
select * where {
    service <http://localhost:5820/exemple1>
    {
        ?s ?f ?l
    }
    service <http://localhost:5820/exemple2>
    {
        ?l ?d ?e
    }
}

```

I seem to remember there might be a shortcut url if the other database is on the same server where you wouldn't need to include the server name and port but I can't remember it off the top of my head.

It seems as thought you might be confusing how SERVICE and now some triple stores implement FROM where the url is dereferenced but I should mention that Stardog doesn't not dereference URIs in FROM statements.

---

<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: [April 13, 2020, 10:54pm UTC](https://community.stardog.com/t/federation-query/2346/3 "2020-04-13T22:54:35Z")

</div>

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