# SPARQL Kit Issue

**URL:** <https://community.stardog.com/t/sparql-kit-issue/4271>\
**Category:** Support\
**Created:** [February 22, 2023, 10:46pm UTC](https://community.stardog.com/t/sparql-kit-issue/4271 "2023-02-22T22:46:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![thunderbolt\_132](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@thunderbolt\_132](https://community.stardog.com/u/thunderbolt_132)\
**Post date:** [February 22, 2023, 10:46pm UTC](https://community.stardog.com/t/sparql-kit-issue/4271/1 "2023-02-22T22:46:25Z")

</div>

Hi everyone,

as you will see from the question, I am just beginning to learn about graph databases. I am trying to go through the [SPARQL Kit](https://cloud.stardog.com/kits/tutorial:music:1.0), but as soon as I start writing queries I get nothing.

If I write the return all query like below, I get the results.

SELECT \*

WHERE{  
?s ?p ?0 .  
}

However, any other query does not work, including those from the kit. I am not sure what I am doing wrong, so any help is welcome.

Thanks!

---

<div class="post-metadata">

**Author:** ![Laura\_Firey](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/laura_firey/32/635_2.png) [@Laura\_Firey](https://community.stardog.com/u/Laura_Firey)\
**Post date:** [February 23, 2023, 4:21pm UTC](https://community.stardog.com/t/sparql-kit-issue/4271/2 "2023-02-23T16:21:03Z")

</div>

The default namespace is not set correctly for this kit. We're sorry for any confusion that this has caused!

To work through this kit with minimal changes, please navigate to the Databases hub, Namespace tab, change the IRI for the blank prefix from `http://api.stardog.com/` to `http://stardog.com/tutorial/`, and save the change.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/f/f8ac042e6c96d15053b970c6df25b261d38a35c3.jpeg)

The tutorial queries should run as expected.

---

<div class="post-metadata">

**Author:** ![thunderbolt\_132](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@thunderbolt\_132](https://community.stardog.com/u/thunderbolt_132)\
**Post date:** [February 23, 2023, 5:03pm UTC](https://community.stardog.com/t/sparql-kit-issue/4271/3 "2023-02-23T17:03:32Z")

</div>

Thank you for the quick response Laura 🙂  
Would it be an issue to elaborate a bit further on the issue, what does the default namespace actually do? Just so I can undestand what is going on behind the scenes, it could help in the future.

---

<div class="post-metadata">

**Author:** ![Laura\_Firey](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/laura_firey/32/635_2.png) [@Laura\_Firey](https://community.stardog.com/u/Laura_Firey)\
**Post date:** [February 23, 2023, 5:24pm UTC](https://community.stardog.com/t/sparql-kit-issue/4271/4 "2023-02-23T17:24:33Z")

</div>

Sure!

Stardog uses namespaces to help reduce the text needed in each query. Namespaces can be considered variables and are pairs of prefixes and IRIs. The prefix is a variable for the full IRI.

So instead of writing,

```auto
SELECT ?album
WHERE {
   ?album rdf:type <http://stardog.com/tutorial/Album> .
}

```

You can use a namespace so that you don't have to write out `http://stardog.com/tutorial/` every time. Stardog includes a few common namespaces by default for each database.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/d/d90e68a1f4bb6e1f5921c7c941c134f2e326092e.jpeg)

Query when the namespace is defined:

```auto
SELECT ?album
WHERE {
   ?album rdf:type :Album .
}

```

Stardog will replace `:` (the blank prefix) with the full IRI from the namespace pair, `http://stardog.com/tutorial/`.

Alternatively, prefixes can be defined in the same tab in the workspace above your query.

```auto
@prefix : <http://stardog.com/tutorial/> .

SELECT ?album
WHERE {
   ?album rdf:type :Album .
}

```

The issue with the kit is that the namespace with the blank prefix was set to `http://api.stardog.com/` instead of `http://stardog.com/tutorial/`. Therefore when you running the query:

```auto
SELECT ?album
WHERE {
   ?album rdf:type :Album .
}

```

It was interpreted as

```auto
SELECT ?album
WHERE {
   ?album rdf:type <http://api.stardog.com/Album> .
}

```

And since there are no instances of `http://api.stardog.com/Album` (only instances of `http://stardog.com/tutorial/Album`) no results were being returned.

This training also might be helpful for understanding some of the fundamentals of RDF and SPARQL.

> **[Trainings - Getting Started with RDF & SPARQL | Stardog](https://www.stardog.com/trainings/getting-started-with-rdf-sparql/)**
>
> This beginner-level training teaches the basics of RDF graphs and the SPARQL query language. Review the basics of RDF data including graph, triples, nodes, IRIs, prefixes, datatypes, and Turtle. By the end of this training, you will understand how to...

---

<div class="post-metadata">

**Author:** ![jdemar](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@jdemar](https://community.stardog.com/u/jdemar)\
**Post date:** [May 3, 2023, 6:54pm UTC](https://community.stardog.com/t/sparql-kit-issue/4271/5 "2023-05-03T18:54:42Z")

</div>

Hello,  
I completed the "Getting Started...Learn SPARQL" using the Beatles and music DB's. Now, I'm trying to apply my learning to the Customer 360 Knowledge Kit. I made the namespace change recommended above, but I'm still getting zero results from a basic Select Profile. I would expect a list of customers from this query:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/0/0f251a81a1d86031984dcea6524a9981420f39c8.png)  
What am I missing?  
Thx,  
Jim

---

<div class="post-metadata">

**Author:** ![StevePlace](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/steveplace/32/1989_2.png) [@StevePlace](https://community.stardog.com/u/StevePlace)\
**Post date:** [May 3, 2023, 9:12pm UTC](https://community.stardog.com/t/sparql-kit-issue/4271/6 "2023-05-03T21:12:42Z")

</div>

Hi Jim,

`:Profile` (or more accurately, `http://stardog.com/tutorial/Profile`) doesn't refer to anything in this demo kit. The query you're looking for is:

```auto
prefix acme: <http://acme.com/> 

select * 
{
    ?s a acme:ProfileId ;
}

```

To avoid having to type out the `acme` prefix every time, you can add it to the namespaces tab like Laura mentioned above for the default prefix.

I'm sure you're wondering how you could've figured this out yourself. When I looked into it, I ran a simple `SELECT * { ?s ?p ?o } LIMIT 10`. I got lucky [1], and the first results were all of the form:  
`http://acme.com/profile_id_1	rdf:type	http://acme.com/ProfileId`

I figured this was what I was looking for, so I tried to see if this could get me results on Kathy Escobar, who's searched for in the first and third gifs of the [kit page](https://cloud.stardog.com/kits/stardog:c360-demo:1.0).

```auto
select * 
{
    ?s a acme:ProfileId ;
       acme:fullName "Kathy Escobar" .
}

```

This gave me the result `http://acme.com/profile_id_19`, which is the same IRI we see in those gifs.

Let me know if that answers your question.

Best,  
Steve

[1] Obviously you can't always expect to get lucky when searching this way. In most real world situations, you have access to the data that went into the database, so you can search through the data directly to find the IRI you were looking for.

---

<div class="post-metadata">

**Author:** ![jdemar](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@jdemar](https://community.stardog.com/u/jdemar)\
**Post date:** [May 4, 2023, 3:12pm UTC](https://community.stardog.com/t/sparql-kit-issue/4271/7 "2023-05-04T15:12:27Z")

</div>

Thanks, @StevePlace; fixing the prefix and using ProfileId resulted in a list of IRIs.  
What's the difference between ProfileId and Profile?

I started with Profile, as it seemed to be the node containing customers. I saw Profile in Explorer both in the Query Builder and the schema:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/1/10fae358bc747fbd022cf0c94df0c8e22130d7b5.png)

---

<div class="post-metadata">

**Author:** ![StevePlace](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/steveplace/32/1989_2.png) [@StevePlace](https://community.stardog.com/u/StevePlace)\
**Post date:** [May 4, 2023, 4:10pm UTC](https://community.stardog.com/t/sparql-kit-issue/4271/8 "2023-05-04T16:10:57Z")

</div>

`Profile` is a class, which is why you see it in Explorer. `ProfileId` is the unique identifier for each of the instances of the `Profile` class.

Seeing the Models tab of Studio might help. You can see `ProfileId` above `studio:label` and that `rdfs:label` is equal to `Profile`.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/e9f27992fb0419cd59dd31a69b1253ddf14301df.png)

Best,  
Steve
