Displaying data help

I am new with sparql. I have this employee class and I want to print out the columns in that class.

Employee class

Instances

My query:
SELECT *
WHERE {
?Employee a :employee ;
:LastName ?LastName ;
:Location ?Location.
}

I am getting an empty output. Can you help me modify my query?

Try the following query

SELECT *
WHERE {
?Employee a :employee ;
<http://api.stardog.com#LastName> ?LastName ;
<http://api.stardog.com#Location> ?Location.
}

The properties aren't in the default Stardog empty namespace.

Thank you. Can you please tell me how do I set the properties in default Stardog namespace? Do I do that during the import?

I tried to add as below but not working. Am I missing something?

SkillList:useYourDefineHere

maybe because the "default" ":" is set to http://api.stardog.com/

if you want to use default

:useYourDefineHere

you would like to replace the first one http://api.stardog.com/ to

http:/api.stardog.com/SkillList/YourDefineHere

unless you want your IRI looks this

http:/api.stardog.com#SkillListYourDefineHere

paste part of your .ttl file to check what IRI looks like?


:Permisson <http://kim.jong.un/onto#Permission\>

You're close. You probably want to make it

Prefix: SkillList IRI: http://api.stardog.com#

which would make your query

SELECT *
WHERE {
    ?Employee a :employee ;
    SkillList:LastName ?LastName ;
    SkillList:Location ?Location.
}

Some explanation on what's going on here. Namespaces are just a shorthand for writing out a long url. The prefix is replaced by whatever namespace you assign to it. You can always write out the full url surrounded by angle brackets to indicate that it's a url. Namespaces can be anything you want including an empty namespace which would be just a :.

As a convenience to the user Stardog automatically assigns this namespace to http://api.stardog.com/ . The user is free to change that if they like. As you can see in your query the :employee uses that namespace.

What may be somewhat confusing is that the properties LastName and Location are in a slightly different namespace, http://api.starodg.com#. Take note of the tailing # rather than a /.

You can either write out the complete url or define a namespace for http://api.stardog.com#.

In your example you defined prefix: SkillList, iri: http://api.stardog.com#SkillList which whould translate to the following prefixes for your query

<http://api.stardog.com#SkillListLastName> <http:///api.starod.com#SkillListLocation>

and would not return any results since it doesn't match what's in your database.

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