As shown in this question which has a similar title, I would like to retrieve a dbpedia resource by knowing a part of its name. I'm a beginner when it comes to SPARQL and such, but the example in the question helped me a lot, as the author searched for "Romania", and the person answering hooked him up with a Sparql request to do the job. That's nice, but here's the thing.
In the example, they already "knew" that Romania is a country, hence the
?c a dbpedia-owl:Country ;
in the WHERE clause. The complete sparql request being
SELECT ?c
WHERE {
?c a dbpedia-owl:Country ;
foaf:name "Romania"@en .
FILTER NOT EXISTS {?c dbpedia-owl:dissolutionYear ?y}
}
But, this question doesn't quite completely answer our need, hence searching for ANY resource by its name, the "name" being the actual name of a resource, or a part of it, regardless of its (rdf:)type. The goal would be to search for "anything", just knowing the name or a part of it.
I've been doing some research before asking you guys this question, and I already know that the "part of the name" problem could be resolved with bif function (the bad way, since it's not sparql compliant), or the CONTAINS clause, but I couldn't find any example showing how to use it.
Let's now suppose that there's a "word" to search for among the dbpedia resources, that word would be an input from some user. And let's call it "INPUT".
The request, I would imagine, would look like :
SELECT ?something WHERE
{
?something a (dbpedia Resource).
CONTAINS(?something,"INPUT")
}
My major question is about two major aspects :
- Is there anything that describes the type Dbpedia Resource ? I don't think it's in ontology or anything. By knwoing that I would like to search among all the resources to find one matching ...
- A specific name I would provide, or some string. I considered the FILTER option, but that would mean getting ALL the resources, and then filtering them by their name after they have been retreived, which would be, I guess, not so optimal.
So, does anyone knows this "Master Query" to get a resource by providing its name, or a part of it ? (An example being providing "Obama", and getting results not only for Barrack, but for Michelle as well).
Thank you in advance.