Hi Andrew,

On 10/26/2012 11:13 PM, Andrew Pennebaker wrote:
There seems to be no consistent way to query for programming languages based on name. Examples:

http://dbpedia.org/page/D_(programming_language) <http://dbpedia.org/page/D_%28programming_language%29>
rdfs:label "D (programming language)"@en
dbpprop:name "D programming language"
owl:sameAs freebase:"D (programming language)"
foaf:name "D programming language"

vs.

http://dbpedia.org/page/C++
rdfs:label "C++"@en
dbpprop:name "C++"
owl:samwAs freebase:"C++"
foaf:name "C++"

Since there's no standard convention for whether "programming language", "(programming language)", "programming_language", "(programming_language", or "" is part of a name for a programming language in dbpedia, I have no idea how to consistently search by name.

I'd like to create some sort of SPARQL query that returns http://dbpedia.org/page/D_(programming_language) <http://dbpedia.org/page/D_%28programming_language%29> for "D" and http://dbpedia.org/page/C++ for "C++", but I don't know how do to this.

Unless at least one of the various triples for programming languages uses a consistent naming convention, I'll have to hack it by querying first against name + " (programming_language)", and falling back to name + "(programming language", name + " programming language" when no results are found. But I'd like a much more robust method.

You can use regex to match it.
So for D programming language you can use:

   SELECT * WHERE { ?language rdf:type dbpedia-owl:ProgrammingLanguage.
   ?language rdfs:label ?lbl. filter(regex(?lbl, '^D+', 'i') ) }

and for C++ you can use:

   SELECT * WHERE { ?language rdf:type dbpedia-owl:ProgrammingLanguage.
   ?language rdfs:label ?lbl. filter(regex(?lbl, '^C\\+\\++', 'i') ) }



--
Cheers,

Andrew Pennebaker
www.yellosoft.us <http://www.yellosoft.us>

Hope that helps.

--
Kind Regards
Mohamed Morsey
Department of Computer Science
University of Leipzig

------------------------------------------------------------------------------
WINDOWS 8 is here. 
Millions of people.  Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/
_______________________________________________
Dbpedia-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion

Reply via email to