Query using :Band returns zero rows for virtual graph tutorial

After following the steps in this tutorial Using Virtual Graphs | Stardog Documentation Latest
the following query returns nothing. Why?

PREFIX : <http://stardog.com/tutorial/>
SELECT ?member ?name {
   GRAPH <virtual://music> {
      ?band a :Band ;
            :name "The Beatles" .
      ?member :member ?band ;
            :name ?name .
   }
}

I have used the correct files from github tutorials repo.

However this query return correct rows:

PREFIX : <http://stardog.com/tutorial/>
SELECT * 
FROM <virtual://music> {
      ?album a :Album ;
             :date ?date;
             :name ?name
} 

I'd take a look at the logs. Check that the default namespace is in there correctly (although the second query returning means that's probably not it. I see your'e including it in the query). Check that the data is actually in the source database. Make the query broader. Try just ?band a :Band to see if there are any Band's in there and if that works try ?member :member ?band to see if there are any members?

Zach,

Logs show nothing except when I get the query syntax wrong. Where do I check "the default namespace"?

This query returns one row:

PREFIX : <http://stardog.com/tutorial/>
SELECT * 
FROM <virtual://music> {
      ?band a :Band 
} 

image

This query returns rows:

PREFIX : <http://stardog.com/tutorial/>
SELECT * 
FROM <virtual://music> {
      ?band a :Band .
      ?member :member ?band 
} 

Data in Artist table:
image

Which should bring one row according to this mapping fragment, right?

:Artist{id} a :Band ;
            sm:map [ sm:query "SELECT id FROM Artist WHERE type = 2" ]  .

You'd list the namespaces with stardog namespace list <db-name> but I don't think that would be an issue. You're including the empty namespace in the query. Unless it's not overriding it for some reason. The tutorial included a line about setting the empty namespace so I wasn't sure if you did that or not.

Something certainly looks off. It's returning an artist where it should be returning a band. I'd double check the mapping file and the source database.

Zach,

How about both us try this tutorial in a clean new environment? Maybe with all the latest stardog changes somehow virtual graph tutorial is lagging?

Regards,
Radu

I missed the section on the database. I'm not familiar with the tutorial so I guess there's a type field where an Artist is a band and from what you showed it's returning correctly. What would be missing is anything from another mapping that mapped all the regular bands. I'm guessing there's a Band table somewhere. There also seems to be a problem with the mapping from artist to band because The Beatles is only listing 4 members and there should be 5 unless it was the week George quit.

I'll see if I can find some time to run through the tutorial, give me a little bit though.

@R3000 can you try this query? I rewrote the query from the tutorial to select from the local named graph and the music named graph. The query pulls a mix of data that has been virtualized from the music database as well as the birthdate data that was inserted into Stardog. You could achieve a similar effect by selecting these 2 named graphs in Studio or turning on Virtual Transparency. In these 2 cases you would not need to specificy the named graphs in the query.

SELECT ?member ?name ?birthDate ?bandName
FROM NAMED <virtual://music> 
FROM NAMED <stardog:context:local>
{
  
      ?band a :Band ;
            :name ?bandName.
   ?member :birthDate ?birthDate;
           :member ?band;
           :name ?name
}