0

I am running a test query on SPARQL to test inferencing. My query is as follows:

    PREFIX eem: <http://purl.org/eem#>
    PREFIX ns: <http://purl.org/net/ns/>
    PREFIX sc_data: <http://purl.org/net/ns/sc_data/>
    PREFIX dbp: <http://dbpedia.org/resource/>
    PREFIX dbpprop: <http://dbpedia.org/property/>
    PREFIX ex: <http://www.example.org/rdf#>
    SELECT  ?roa
    WHERE {
    SERVICE <http://dbpedia.org/sparql>{
    ex:vaccine a dbp:Polio_vaccine.
    ex:vaccine dbpprop:routesOfAdministration ?roa.
}
    }

I get no results for this query when trying at the snorql page. When I specify that something is polio vaccine, shouldn't it automatically inherit the properties specified for the vaccine? What do I need to change?

kurious
  • 1,024
  • 10
  • 29
  • Why do you think `a dbp:Polio_vaccine` should work? – svick May 14 '15 at 00:43
  • I was under the impression that we can use a (rdf:type) to specify the class of a subject. How else can one specify that ex:vaccine is a Polio vaccine? – kurious May 14 '15 at 11:04
  • I don't know. I'm not sure DBpedia contains that information or that what you're asking even makes sense. Could you name a few vaccines that you would expect to fulfill your criteria? – svick May 14 '15 at 11:15
  • 1
    @kurious I see that you just updated your question, but the addition of the service keyword doesn't really change the issue. It sounds like you're expecting DBpedia to contain data that it simply doesn't contain, and expecting DBpedia to perform reasoning and inference that it never claims to perform. – Joshua Taylor Jun 25 '15 at 15:56

1 Answers1

2

In your original query, ex:vaccine is a URI node, short for <http://www.example.org/rdf#vaccine>. It's very unlikely that DBpedia contains any information about it. While the DBpedia endpoint may (or may not) include information that is inferrable from the DBpedia data, it doesn't treat your SPARQL query as part assertion and part query.

You're literally saying "find values of ?roa such that ?roa is the route of administration of ex:vaccine and ex:vaccine is an instance of dbp:Polio_vaccine". ex:vaccine is a constant though, so it's kind of like saying, "find factors of 10, and by the way, 10 is the sum of 3 and 4." The "10 is the sum of 3 and 4" isn't in the data, though, so there won't be any matches, even if there are recorded factors of 10. On top of that, dbp:Polio_vaccine is an individual in DBpedia, not a class, so there won't be any instance of it.

Instead, you want to ask for any values of the dbpprop:routesOfAdministation property for the individual dbpedia:Polio_vaccine. The query you need here is (I'm using the prefixes that are defined at http://dbpedia.org/sparql, the public endpoint):

select ?routes where {
  dbpedia:Polio_vaccine dbpprop:routesOfAdministration ?routes
}

SPARQL results

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
  • Thank you for your detailed explanation, Joshua. It is very helpful. I figured that I could get the roa using the query you wrote above. However what I'm trying to do is this: 1. In my data, I have something that I know is a polio vaccine. However, it's roa is not mentioned in the data. 2. So, I want to say that the entity in my data is the polio vaccine mentioned in dbpedia. And given that the roa of polio vaccine is "oral", I want the computer to infer that the roa of the vaccine in my data is also "oral". Can you please help me figure out how to write such a query? – kurious May 15 '15 at 05:58
  • Requesting help on this. Can someone please respond? – kurious May 26 '15 at 01:37
  • Hi Joshua. I don't yet know how to resolve the issue. I gather that using the SERVICE clause in SPARQL might be useful. Can you please help me figure out the solution? – kurious Jun 25 '15 at 15:52
  • @kurious I don't really see how the `service` keyword is relevant to this question. If you have a new question, you could certainly post it as a new question. – Joshua Taylor Jun 25 '15 at 15:54
  • In my understanding, the SERVICE keyword enables us to run federated query and/or access other SPARQL end-points. For instance, "dbpedia:Polio_vaccine dbpprop:routesOfAdministration ?routes" under the SERVICE clause will work in a triplestore such as Sesame (without the need for creating a separate repository). Can you please let me know how I can assert that the vaccine in my dataset is a Polio Vaccine and thus inherits its properties? Thank you very much! – kurious Jun 25 '15 at 17:39
  • Yes, SERVICE lets you query other endpoints. It doesn't force them, or your SPARQL service, to do any inferencing. – Joshua Taylor Jun 25 '15 at 17:40
  • Thank you, Joshua. Do you have suggestions on what I can do differently regarding the assertion? Is installing OWLIM and using owl:SameAs a sensible approach? – kurious Jun 25 '15 at 17:55
  • This is a partial answer. The following query works: SELECT ?roa WHERE { SERVICE { ?vaccine owl:sameAs yago:Rotavirus_vaccine. ?vaccine dbpprop:routesOfAdministration ?roa. } } When I replace the ?vaccine variable with specific entities from my dataset, the query doesn't work anymore. Suggestions on how to resolve the issue please. – kurious Jun 25 '15 at 19:45
  • @kurious Why would you expect DBpedia to know anything about the specific entities from your dataset? You are *querying* DBpedia, you're not *asserting* anything to DBpedia. – Joshua Taylor Jun 25 '15 at 19:55
  • Thank you, Joshua. When I assert that ?vaccine is a yago:Rotavirus_vaccine, the query works. If a variable can work, can an entity from my dataset not work? I think I get your point about asserting. What I'm trying to do is let dbpedia know that the entity is same as yago:Rotavirus_vaccine. Please let me know how I should tweak the query. – kurious Jun 25 '15 at 20:07
  • @kurious I think I've said this plenty of times now, so I probably won't say it anymore. You're not *asserting* anything to DBpedia. You *can't* assert anything to DBpedia. You're mistaken when you say that "When I assert that ?vaccine is a yago:Rotavirus_vaccine, the query works. " You're not asserting anything. You're *asking* whether there are any values for ?vaccine such that "?vaccine is a yago:Rotavirus_vaccine". (The answer is "yes".) When you replace ?vaccine with some particular value X, you're *asking* whether or not that X is a rotavirus. DBpedia says "no". – Joshua Taylor Jun 25 '15 at 20:26
  • Thank you for patiently answering (again), Joshua. I think I understand now :-). I'll work on developing a better conceptual understanding of how I and cannot use dbpedia. My apologies for being a bit of a drain on your time. – kurious Jun 25 '15 at 22:07
  • Hi again, Joshua. I extracted the triples of my interest from DBpedia (those that have Rotavirus_Vaccine as subject or object) and added them to my Sesame repository. My query still doesn't work. By adding the relevant DBpedia data to my repository, I was under the impression that I've circumvented the need to try to assert something to DBpedia (which as you explained is incorrect). Can you please help me understand what I'm doing incorrectly now? – kurious Jul 06 '15 at 03:33