From: <chr...@us...> - 2011-05-24 15:57:45
|
Revision: 2819 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2819&view=rev Author: christinaunger Date: 2011-05-24 15:57:37 +0000 (Tue, 24 May 2011) Log Message: ----------- [tbsl] included NER into ltag.parser.Preprocessor Modified Paths: -------------- trunk/components-ext/failed.txt trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Parser.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/SlotBuilder.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/Templator.java trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/NERTest.java trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/PatternMatchingTest.java trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/TemplateGenerationTest.java trunk/components-ext/successful.txt Modified: trunk/components-ext/failed.txt =================================================================== --- trunk/components-ext/failed.txt 2011-05-24 13:54:41 UTC (rev 2818) +++ trunk/components-ext/failed.txt 2011-05-24 15:57:37 UTC (rev 2819) @@ -1,19 +1,16 @@ -Which presidents were born in 1945? -Who developed the video game World of Warcraft? -List all episodes of the first season of the HBO television series The Sopranos! -Which people have as their given name Jimmy? -Is there a video game called Battle Chess? -Which companies work in the aerospace industry as well as on nuclear reactor technology? -Which country does the Airedale Terrier come from? -Which cities have more than 2 million inhabitants? -Who was Tom Hanks married to? -Which capitals in Europe were host cities of the summer olympic games? -Who has been the 5th president of the United States of America? -Which music albums contain the song Last Christmas? -Which genre does DBpedia belong to? -In which programming language is GIMP written? -In which films did Julia Roberts as well as Richard Gere play? -Who wrote the book The pillars of the Earth? -How many films did Leonardo DiCaprio star in? -Which organizations were founded in 1950? -Is Natalie Portman an actress? +Who is the daughter of Bill Clinton married to? +Where did Abraham Lincoln die? +In which country does the Nile start? +Is proinsulin a protein? +Which classis does the Millepede belong to? +How tall is Claudia Schiffer? +Give me the capitals of all U.S. states. +Is Egypts largest city also its capital? +In which country is the Limerick Lake? +In which films directed by Garry Marshall was Julia Roberts starring? +Was U.S. president Jackson involved in a war? +Which state of the United States of America has the highest density? +Which countries in the European Union adopted the Euro? +Through which countries does the Yenisei river flow? +When was the Battle of Gettysburg? +What did Bruce Carver die from? Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Parser.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Parser.java 2011-05-24 13:54:41 UTC (rev 2818) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Parser.java 2011-05-24 15:57:37 UTC (rev 2819) @@ -80,7 +80,7 @@ internalParse(parseGrammar.getDPInitTrees(), n); } - System.out.println("Constructed " + derivationTrees.size() + " derivation trees."); + System.out.println("Constructed " + derivationTrees.size() + " derivation trees.\n"); return derivationTrees; } Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java 2011-05-24 13:54:41 UTC (rev 2818) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java 2011-05-24 15:57:37 UTC (rev 2819) @@ -6,6 +6,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.dllearner.algorithm.tbsl.nlp.LingPipeNER; +import org.dllearner.algorithm.tbsl.nlp.NER; import org.dllearner.algorithm.tbsl.sem.util.Pair; public class Preprocessor { @@ -160,4 +162,49 @@ return flat; } + + public static String findNEs(String tagged,String untagged) { + + String out = tagged; + + NER ner = new LingPipeNER(); + List<String> namedentities = ner.getNamedEntitites(untagged); + List<String> usefulnamedentities = new ArrayList<String>(); + + System.out.println("Proposed NEs: " + namedentities); + + // keep only longest matches (e.g. keep 'World of Warcraft' and forget about 'Warcraft') + // containing at least one upper case letter (in order to filter out errors like 'software') + for (String s1 : namedentities) { + if (s1.matches(".*[A-Z].*")) { + boolean isLongestMatch = true; + for (String s2 : namedentities) { + if (!s2.equals(s1) && s2.contains(s1)) { + isLongestMatch = false; + } + } + if (isLongestMatch) { + usefulnamedentities.add(s1); + } + } + } + + System.out.println("Accepted NEs: " + usefulnamedentities); + + // replace POS tags accordingly + for (String ne : usefulnamedentities) { + String[] neparts = ne.split(" "); + Pattern p; Matcher m; + for (String nep : neparts) { + p = Pattern.compile("(\\s)?(" + nep + "/([A-Z]+))(\\s)?"); + m = p.matcher(out); + while (m.find()) { + out = out.replaceFirst(m.group(2),nep+"/NNP"); + } + } + } + + return out; + } + } Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/SlotBuilder.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/SlotBuilder.java 2011-05-24 13:54:41 UTC (rev 2818) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/SlotBuilder.java 2011-05-24 15:57:37 UTC (rev 2819) @@ -66,6 +66,7 @@ slotX += next; slotP += next; slotC += next; if (i.hasNext()) { slotX += "^"; slotP += "^"; slotC += "^"; } } + // treetoken String treetoken = "N:'" + token.toLowerCase() + "'"; if (token.trim().contains(" ")) { String[] tokenParts = token.split(" "); @@ -75,17 +76,26 @@ } treetoken = treetoken.trim(); } + // if (pos.equals("NN") || pos.equals("NNS")) { /* DP */ - String[] dpEntry = {token, + String[] dpEntry1 = {token, "(DP (NP " + treetoken + "))", "<x,l1,<<e,t>,t>,[ l1:[ x | SLOT_" + tokenfluent + "(x) ] ],[],[],[" + slotP + "]>"}; - result.add(dpEntry); + String[] dpEntry2 = {token, + "(DP (NP " + treetoken + " DP[name]))", + "<x,l1,<<e,t>,t>,[ l1:[ x | SLOT_" + tokenfluent + "(x), equal(x,y) ] ],[ (l2,y,name,<<e,t>,t>) ],[l2=l1],[" + slotP + "]>"}; + result.add(dpEntry1); + result.add(dpEntry2); /* NP */ - String[] npEntry = {token, + String[] npEntry1 = {token, "(NP " + treetoken + ")", "<x,l1,<e,t>,[ l1:[ | SLOT_" + tokenfluent + "(x) ] ],[],[],[" + slotP + "]>"}; - result.add(npEntry); + String[] npEntry2 = {token, + "(NP " + treetoken + " DP[name])", + "<x,l1,<e,t>,[ l1:[ | SLOT_" + tokenfluent + "(x), equal(x,y) ] ],[ (l2,y,name,<<e,t>,t>) ],[l2=l1],[" + slotP + "]>"}; + result.add(npEntry1); + result.add(npEntry2); } else if (pos.equals("NNP") || pos.equals("NNPS")) { /* DP */ @@ -215,7 +225,7 @@ /* ADJECTIVES */ else if (equalsOneOf(pos,adjective)) { - String slot = "SLOT_" + token + "/PROPERTY/"; + String slot = "SLOT_" + token + "/PROPERTY/" + token; List<String> preds = wordnet.getAttributes(token); for (Iterator<String> i = preds.iterator(); i.hasNext();) { slot += i.next(); Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/Templator.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/Templator.java 2011-05-24 13:54:41 UTC (rev 2818) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/Templator.java 2011-05-24 15:57:37 UTC (rev 2819) @@ -53,8 +53,8 @@ s = Preprocessor.normalize(s); String tagged = tagger.tag(s); System.out.println("Tagged input: " + tagged); - - String newtagged = Preprocessor.condenseNominals(tagged); + + String newtagged = Preprocessor.condenseNominals(Preprocessor.findNEs(tagged,s)); newtagged = Preprocessor.condense(newtagged); System.out.println("Preprocessed: " + newtagged); @@ -88,7 +88,12 @@ d2s.redundantEqualRenaming(drs); if (!containsModuloRenaming(drses,drs)) { - System.out.println(drs); // DEBUG +// // DEBUG +// System.out.println(drs); +// for (Slot sl : slots) { +// System.out.println(sl.toString()); +// } +// // drses.add(drs); try { Modified: trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/NERTest.java =================================================================== --- trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/NERTest.java 2011-05-24 13:54:41 UTC (rev 2818) +++ trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/NERTest.java 2011-05-24 15:57:37 UTC (rev 2819) @@ -12,20 +12,35 @@ * @param args */ public static void main(String[] args) { - String sentence = "Which software company produced World of Warcraft?"; + + List<String> namedEntities; - NER ner = new DBpediaSpotlightNER(); - long startTime = System.currentTimeMillis(); - List<String> namedEntities = ner.getNamedEntitites(sentence); + NER dbpner = new DBpediaSpotlightNER(); + NER lpner = new LingPipeNER(); + + String sentence1 = "Which software company produced World of Warcraft?"; + + long startTime = System.currentTimeMillis(); + namedEntities = dbpner.getNamedEntitites(sentence1); System.out.format("Using DBpedia Spotlight WebService (%d ms):\n", System.currentTimeMillis()-startTime); System.out.println(namedEntities + "\n"); - ner = new LingPipeNER(); startTime = System.currentTimeMillis(); - namedEntities = ner.getNamedEntitites(sentence); + namedEntities = lpner.getNamedEntitites(sentence1); System.out.format("Using Lingpipe API with local DBpedia dictionary (%d ms):\n", System.currentTimeMillis()-startTime); System.out.println(namedEntities); + String sentence2 = "Give me all actors of the television series Charmed and did Nirvana record Nevermind?"; + + startTime = System.currentTimeMillis(); + namedEntities = dbpner.getNamedEntitites(sentence2); + System.out.format("Using DBpedia Spotlight WebService (%d ms):\n", System.currentTimeMillis()-startTime); + System.out.println(namedEntities + "\n"); + + startTime = System.currentTimeMillis(); + namedEntities = lpner.getNamedEntitites(sentence2); + System.out.format("Using Lingpipe API with local DBpedia dictionary (%d ms):\n", System.currentTimeMillis()-startTime); + System.out.println(namedEntities); } } Modified: trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/PatternMatchingTest.java =================================================================== --- trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/PatternMatchingTest.java 2011-05-24 13:54:41 UTC (rev 2818) +++ trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/PatternMatchingTest.java 2011-05-24 15:57:37 UTC (rev 2819) @@ -11,13 +11,14 @@ public static void main(String[] args) { // TODO Auto-generated method stub - String s = "New/NNP York/NNP City/NNP is/VBZ a/DT US/NNP state/NN"; + String nep = "World"; + String s = "Who/WP developed/VBD the/DT video/NN game/NN World/NN of/IN Warcraft/NNP"; - Pattern nprepPattern = Pattern.compile("\\s?((\\w+)/NNP[S]?)\\s(\\w+)/NN[S]?(\\W|$)"); - Matcher m = nprepPattern.matcher(s); + Pattern p = Pattern.compile("(\\s)?(" + nep + "/([A-Z]+))(\\s)?"); + Matcher m = p.matcher(s); while (m.find()) { - System.out.println("Found!"); - s = s.replaceFirst(m.group(1),m.group(2) + "/JJ"); + System.out.println("Found! " + m.group(2)); + s = s.replaceFirst(m.group(2),nep+"/NNP"); } System.out.println(s); Modified: trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/TemplateGenerationTest.java =================================================================== --- trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/TemplateGenerationTest.java 2011-05-24 13:54:41 UTC (rev 2818) +++ trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/TemplateGenerationTest.java 2011-05-24 15:57:37 UTC (rev 2819) @@ -59,7 +59,7 @@ * @param args */ public static void main(String[] args) { - File file = new File("src/main/resources/tbsl/evaluation/dbpedia-train.xml"); + File file = new File("src/main/resources/tbsl/evaluation/dbpedia-test-questions.xml"); List<String> questions = readQuestions(file); StringBuilder successful = new StringBuilder(); Modified: trunk/components-ext/successful.txt =================================================================== --- trunk/components-ext/successful.txt 2011-05-24 13:54:41 UTC (rev 2818) +++ trunk/components-ext/successful.txt 2011-05-24 15:57:37 UTC (rev 2819) @@ -1,197 +1,263 @@ ***************************************************************** -Give me all school types. +Which presidents of the United States had more than three children? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?y WHERE { - ?y rdf:type ?p0 . +SELECT ?x COUNT(?v0) AS ?c WHERE { + ?x ?p6 ?v1 . + ?x ?p5 ?y . + ?v0 rdf:type ?p4 . + ?x rdf:type ?p3 . + FILTER(?c > 3) . } >> SLOTS: -p0: CLASS {school types} +v1: RESOURCE {United States} +p3: CLASS {presidents,president} +p4: CLASS {children,child,kid,youngster,minor} +p5: PROPERTY {had} +p6: PROPERTY {} +>> QUERY: + +PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> + +SELECT ?x COUNT(?v0) AS ?c WHERE { + ?x ?p2 ?y . + ?v1 ?p0 ?x . + ?v0 rdf:type ?p1 . + FILTER(?c > 3) . +} + +>> SLOTS: +v1: RESOURCE {United States} +p0: PROPERTY {presidents,president} +p1: CLASS {children,child,kid,youngster,minor} +p2: PROPERTY {had} ***************************************************************** -Who are the presidents of the United States? +Give me the official websites of actors of the television show Charmed. >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?y WHERE { - ?y rdf:type ?p1 . - ?y ?p2 ?v0 . + ?y ?p0 ?j . + ?v0 ?p2 ?v3 . + ?v3 ?p3 ?y . + ?v0 rdf:type ?p1 . } >> SLOTS: -v0: RESOURCE {United States} -p1: CLASS {presidents,president} -p2: PROPERTY {} +v0: RESOURCE {Charmed} +p0: PROPERTY {official} +p1: CLASS {television show} +p2: PROPERTY {actors,actor,histrion,player,thespian} +p3: PROPERTY {websites,website,site} >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?y WHERE { - ?v0 ?p0 ?y . + ?y ?p9 ?j . + ?v0 rdf:type ?p11 . + ?v0 ?p12 ?v3 . + ?y rdf:type ?p13 . + ?y ?p10 ?v3 . } >> SLOTS: -v0: RESOURCE {United States} -p0: PROPERTY {presidents,president} -***************************************************************** -Who was the wife of President Lincoln? +v0: RESOURCE {Charmed} +p9: PROPERTY {official} +p10: PROPERTY {} +p11: CLASS {television show} +p12: PROPERTY {actors,actor,histrion,player,thespian} +p13: CLASS {websites,website,site} >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?y WHERE { - ?y rdf:type ?p1 . - ?y ?p2 ?v0 . + ?v0 rdf:type ?p16 . + ?y rdf:type ?p18 . + ?y ?p15 ?j . + ?v3 rdf:type ?p17 . + ?v3 ?p14 ?v0 . + ?y ?p14 ?v3 . } >> SLOTS: -v0: RESOURCE {President Lincoln} -p1: CLASS {wife} -p2: PROPERTY {} +v0: RESOURCE {Charmed} +p14: PROPERTY {} +p15: PROPERTY {official} +p16: CLASS {television show} +p17: CLASS {actors,actor,histrion,player,thespian} +p18: CLASS {websites,website,site} >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?y WHERE { - ?v0 ?p0 ?y . + ?v3 ?p7 ?y . + ?y ?p5 ?j . + ?v3 ?p4 ?v0 . + ?v3 rdf:type ?p8 . + ?v0 rdf:type ?p6 . } >> SLOTS: -v0: RESOURCE {President Lincoln} -p0: PROPERTY {wife} +v0: RESOURCE {Charmed} +p4: PROPERTY {} +p5: PROPERTY {official} +p6: CLASS {television show} +p7: PROPERTY {websites,website,site} +p8: CLASS {actors,actor,histrion,player,thespian} +***************************************************************** +Which river does the Brooklyn Bridge cross? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?y WHERE { - ?y ?p5 ?v0 . - ?y rdf:type ?p4 . +SELECT ?v0 WHERE { + ?v0 rdf:type ?p0 . + ?v0 ?p1 ?j . + ?v0 rdf:type ?p2 . } >> SLOTS: -v0: RESOURCE {President Lincoln} -p4: CLASS {wife} -p5: PROPERTY {} +p0: CLASS {river} +p1: PROPERTY {Brooklyn Bridge} +p2: CLASS {cross} +***************************************************************** +How many monarchical countries are there in Europe? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?y WHERE { - ?v0 ?p3 ?y . +SELECT COUNT(?x) WHERE { + ?y rdf:type ?p1 . + ?y ?p0 ?v1 . + ?y ?p2 ?j . + FILTER(?y == ?y) . } >> SLOTS: -v0: RESOURCE {President Lincoln} -p3: PROPERTY {wife} +v1: RESOURCE {Europe} +p0: PROPERTY {} +p1: CLASS {countries,state,nation,country,land} +p2: PROPERTY {monarchical} ***************************************************************** -What is the official website of Tom Hanks? +Is the wife of President Obama called Michelle? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?y WHERE { - ?y ?p9 ?v0 . - ?y ?p8 ?j . - ?y rdf:type ?p7 . +ASK WHERE { + ?y rdf:type ?p2 . + ?y ?p4 'michelle' . + ?y ?p3 ?v0 . } >> SLOTS: -v0: RESOURCE {Tom Hanks} -p7: CLASS {website,site} -p8: PROPERTY {} -p9: PROPERTY {} +v0: RESOURCE {President Obama} +p2: CLASS {wife} +p3: PROPERTY {} +p4: PROPERTY {title,name} >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?y WHERE { - ?v1 ?p1 ?y . - ?y ?p0 ?j . +ASK WHERE { + ?v0 ?p1 ?y . + ?y ?p0 'michelle' . } >> SLOTS: -v1: RESOURCE {Tom Hanks} -p0: PROPERTY {} -p1: PROPERTY {website,site} +v0: RESOURCE {President Obama} +p0: PROPERTY {title,name} +p1: PROPERTY {wife} +***************************************************************** +Which states of Germany are governed by the Social Democratic Party? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?y WHERE { - ?y rdf:type ?p2 . - ?y ?p4 ?j . - ?y ?p3 ?v1 . +SELECT ?x WHERE { + ?x ?p4 ?v0 . + ?x rdf:type ?p3 . + ?y ?p2 ?x . } >> SLOTS: -v1: RESOURCE {Tom Hanks} -p2: CLASS {website,site} -p3: PROPERTY {} +y: RESOURCE {Social Democratic Party} +v0: RESOURCE {Germany} +p2: PROPERTY {governed} +p3: CLASS {states,state,province} p4: PROPERTY {} >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?y WHERE { - ?y ?p6 ?j . - ?v0 ?p5 ?y . +SELECT ?x WHERE { + ?v0 ?p1 ?x . + ?y ?p0 ?x . } >> SLOTS: -v0: RESOURCE {Tom Hanks} -p5: PROPERTY {website,site} -p6: PROPERTY {} +y: RESOURCE {Social Democratic Party} +v0: RESOURCE {Germany} +p0: PROPERTY {governed} +p1: PROPERTY {states,state,province} ***************************************************************** -Who produced the most films? +Which U.S. states possess gold minerals? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT COUNT(?y) AS c2 WHERE { - ?x ?p1 ?y . - ?y rdf:type ?p0 . +SELECT ?x WHERE { + ?x rdf:type ?p2 . + ?x ?p1 ?j . + ?y rdf:type ?p3 . + ?x ?p0 ?y . } -ORDER BY DESC(?c2) -LIMIT 1 OFFSET 0 >> SLOTS: -p0: CLASS {films,movie,film,picture,pic} -p1: PROPERTY {produced} +p0: PROPERTY {possess} +p1: PROPERTY {US} +p2: CLASS {states,state,province} +p3: CLASS {gold minerals} ***************************************************************** -Which mountains are higher than the Nanga Parbat? +Which locations have more than two caves? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?y WHERE { - ?y ?p1 ?j . - ?v0 ?p1 ?i . - ?y rdf:type ?p0 . - FILTER(?j > ?i) . +SELECT ?x COUNT(?v0) AS ?c WHERE { + ?x rdf:type ?p2 . + ?x ?p0 ?y . + ?v0 rdf:type ?p1 . + FILTER(?c > 2) . } >> SLOTS: -v0: RESOURCE {Nanga Parbat} -p0: CLASS {mountains,mountain,mount} -p1: PROPERTY {degree} +p0: PROPERTY {have} +p1: CLASS {caves,cave} +p2: CLASS {locations,location} ***************************************************************** -Who created English Wikipedia? +Who created Goofy? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> @@ -202,25 +268,49 @@ } >> SLOTS: -y: RESOURCE {English Wikipedia} +y: RESOURCE {Goofy} p0: PROPERTY {created} ***************************************************************** -Give me all actors starring in Batman Begins. +Give me all cities in New Jersey with more than 100000 inhabitants. >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?y WHERE { +SELECT ?y COUNT(?v0) AS ?c WHERE { + ?y rdf:type ?p6 . + ?v0 rdf:type ?p4 . + ?y ?p7 ?v3 . + ?v3 ?p5 ?v2 . + FILTER(?c > 100000) . + FILTER(?100000 == 100000) . +} + +>> SLOTS: +p4: CLASS {inhabitants,inhabitant,habitant,dweller,denizen} +p5: PROPERTY {} +p6: CLASS {cities,city,metropolis} +p7: PROPERTY {} +>> QUERY: + +PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> + +SELECT ?y COUNT(?v0) AS ?c WHERE { ?y ?p1 ?v1 . - ?y rdf:type ?p0 . + ?v0 rdf:type ?p0 . + ?y rdf:type ?p2 . + ?y ?p3 ?v3 . + FILTER(?c > 100000) . } >> SLOTS: -p0: CLASS {actors,actor,histrion,player,thespian} -p1: PROPERTY {starring} +p0: CLASS {inhabitants,inhabitant,habitant,dweller,denizen} +p1: PROPERTY {} +p2: CLASS {cities,city,metropolis} +p3: PROPERTY {} ***************************************************************** -Which software has been developed by organizations founded in California? +Which museum exhibits The Scream by Munch? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> @@ -229,372 +319,390 @@ SELECT ?x WHERE { ?y ?p0 ?v1 . ?x rdf:type ?p2 . - ?y ?p1 ?x . - ?y rdf:type ?p3 . + ?x ?p1 ?y . } >> SLOTS: -v1: RESOURCE {California} -p0: PROPERTY {founded} -p1: PROPERTY {developed} -p2: CLASS {software,package} -p3: CLASS {organizations,organization,organisation} +y: RESOURCE {Scream} +v1: RESOURCE {Munch} +p0: PROPERTY {} +p1: PROPERTY {exhibits} +p2: CLASS {museum} ***************************************************************** -Is Christian Bale starring in Batman Begins? +What is the revenue of IBM? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -ASK WHERE { - ?y ?p0 ?v0 . +SELECT ?y WHERE { + ?y rdf:type ?p1 . + ?y ?p2 ?v0 . } >> SLOTS: -y: RESOURCE {Christian Bale} -v0: RESOURCE {Batman Begins} -p0: PROPERTY {starring} -***************************************************************** -Give me the websites of companies with more than 500000 employees. +v0: RESOURCE {IBM} +p1: CLASS {revenue,gross,receipts} +p2: PROPERTY {} >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?y COUNT(?v0) AS ?c WHERE { - ?v1 rdf:type ?p34 . - ?y ?p31 ?v1 . - ?v0 rdf:type ?p32 . - ?y rdf:type ?p35 . - ?v1 ?p33 ?v2 . - FILTER(?c > 500000) . +SELECT ?y WHERE { + ?v0 ?p0 ?y . } >> SLOTS: -p31: PROPERTY {} -p32: CLASS {employees,employee} -p33: PROPERTY {} -p34: CLASS {companies,company} -p35: CLASS {websites,website,site} +v0: RESOURCE {IBM} +p0: PROPERTY {revenue,gross,receipts} +***************************************************************** +Which states border Utah? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?y COUNT(?v0) AS ?c WHERE { - ?y ?p13 ?v2 . - ?y rdf:type ?p17 . - ?y ?p14 ?v1 . - ?v2 rdf:type ?p16 . - ?v0 rdf:type ?p15 . - FILTER(?c > 500000) . +SELECT ?v0 WHERE { + ?v0 rdf:type ?p0 . + ?v0 rdf:type ?p1 . + FILTER(?v0 == ?v0) . } >> SLOTS: -p13: PROPERTY {} -p14: PROPERTY {} -p15: CLASS {employees,employee} -p16: CLASS {companies,company} -p17: CLASS {websites,website,site} +p0: CLASS {states,state,province} +p1: CLASS {border,borderline,delimitation,mete} +***************************************************************** +Which television shows were created by Walt Disney? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?y COUNT(?v0) AS ?c WHERE { - ?y ?p6 ?v3 . - ?y ?p4 ?v1 . - ?y rdf:type ?p8 . - ?v0 rdf:type ?p5 . - ?v3 rdf:type ?p7 . - FILTER(?c > 500000) . +SELECT ?x WHERE { + ?x rdf:type ?p1 . + ?y ?p0 ?x . } >> SLOTS: -p4: PROPERTY {} -p5: CLASS {employees,employee} -p6: PROPERTY {} -p7: CLASS {companies,company} -p8: CLASS {websites,website,site} +y: RESOURCE {Walt Disney} +p0: PROPERTY {created} +p1: CLASS {television shows} +***************************************************************** +Which mountain is the highest after the Annapurna? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?y COUNT(?v0) AS ?c WHERE { - ?v1 ?p29 ?v2 . - ?v0 rdf:type ?p27 . - ?v1 ?p28 ?y . - ?v1 rdf:type ?p30 . - FILTER(?c > 500000) . +SELECT ?j ?y WHERE { + ?y ?p1 ?v1 . + ?y ?p2 ?j . + ?y rdf:type ?p0 . } +ORDER BY DESC(?j) +LIMIT 1 OFFSET 0 >> SLOTS: -p27: CLASS {employees,employee} -p28: PROPERTY {websites,website,site} -p29: PROPERTY {} -p30: CLASS {companies,company} +v1: RESOURCE {Annapurna} +p0: CLASS {mountain,mount} +p1: PROPERTY {} +p2: PROPERTY {highestdegree} +***************************************************************** +Which bridges are of the same type as the Manhattan Bridge? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?y COUNT(?v0) AS ?c WHERE { - ?y ?p0 ?v1 . - ?v3 ?p3 ?y . - ?v3 rdf:type ?p2 . - ?v0 rdf:type ?p1 . - FILTER(?c > 500000) . +SELECT ?y WHERE { + ?y ?p3 ?j . + ?y rdf:type ?p2 . + ?y rdf:type ?p0 . + ?y ?p1 ?v0 . } >> SLOTS: -p0: PROPERTY {} -p1: CLASS {employees,employee} -p2: CLASS {companies,company} -p3: PROPERTY {websites,website,site} +v0: RESOURCE {Manhattan Bridge} +p0: CLASS {bridges,Bridges} +p1: PROPERTY {} +p2: CLASS {type} +p3: PROPERTY {same} +***************************************************************** +Which European countries are a constitutional monarchy? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?y COUNT(?v0) AS ?c WHERE { - ?v1 ?p20 ?v2 . - ?v1 rdf:type ?p21 . - ?v0 rdf:type ?p18 . - ?v1 ?p19 ?y . - FILTER(?c > 500000) . +ASK WHERE { + ?y ?p1 ?j . + ?y ?p2 ?v0 . + ?y rdf:type ?p0 . + ?y rdf:type ?p3 . + FILTER(?y == ?y) . } >> SLOTS: -p18: CLASS {employees,employee} -p19: PROPERTY {websites,website,site} -p20: PROPERTY {} -p21: CLASS {companies,company} +p0: CLASS {monarchy} +p1: PROPERTY {constitutional} +p2: PROPERTY {European} +p3: CLASS {countries,state,nation,country,land} +***************************************************************** +Who is the author of WikiLeaks? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?y COUNT(?v0) AS ?c WHERE { - ?v1 rdf:type ?p25 . - ?v1 ?p24 ?v2 . - ?y rdf:type ?p26 . - ?y ?p22 ?v1 . - ?v0 rdf:type ?p23 . - FILTER(?c > 500000) . +SELECT ?y WHERE { + ?v0 rdf:type ?p2 . + ?y rdf:type ?p4 . + ?y ?p3 ?v0 . } >> SLOTS: -p22: PROPERTY {} -p23: CLASS {employees,employee} -p24: PROPERTY {} -p25: CLASS {companies,company} -p26: CLASS {websites,website,site} +p2: CLASS {WikiLeaks} +p3: PROPERTY {} +p4: CLASS {author,writer} >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?y COUNT(?v0) AS ?c WHERE { - ?v2 ?p12 ?y . - ?v0 rdf:type ?p10 . - ?v2 rdf:type ?p11 . - ?y ?p9 ?v1 . - FILTER(?c > 500000) . +SELECT ?y WHERE { + ?v0 rdf:type ?p0 . + ?v0 ?p1 ?y . } >> SLOTS: -p9: PROPERTY {} -p10: CLASS {employees,employee} -p11: CLASS {companies,company} -p12: PROPERTY {websites,website,site} +p0: CLASS {WikiLeaks} +p1: PROPERTY {author,writer} ***************************************************************** -Which actors were born in Germany? +What is the currency of the Czech Republic? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?x WHERE { - ?x rdf:type ?p0 . - ?x ?p1 ?y . +SELECT ?y WHERE { + ?v0 ?p0 ?y . } >> SLOTS: -y: RESOURCE {Germany} -p0: CLASS {actors,actor,histrion,player,thespian} -p1: PROPERTY {born} -***************************************************************** -Which birds are there in the United States? +v0: RESOURCE {Czech Republic} +p0: PROPERTY {currency} >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?y WHERE { - ?y ?p1 ?v1 . - ?y rdf:type ?p0 . + ?y rdf:type ?p1 . + ?y ?p2 ?v0 . } >> SLOTS: -v1: RESOURCE {United States} -p0: CLASS {birds,bird} -p1: PROPERTY {} +v0: RESOURCE {Czech Republic} +p1: CLASS {currency} +p2: PROPERTY {} ***************************************************************** -Give me all European Capitals! +What is the area code of Berlin? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?y WHERE { - ?y ?p1 ?j . - ?y rdf:type ?p0 . + ?v0 ?p0 ?y . } >> SLOTS: -p0: CLASS {Capitals,capital} -p1: PROPERTY {} -***************************************************************** -When was DBpedia released? +v0: RESOURCE {Berlin} +p0: PROPERTY {area code} >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?y WHERE { - ?x ?p0 ?y . + ?y rdf:type ?p1 . + ?y ?p2 ?v0 . } >> SLOTS: -x: RESOURCE {DBpedia} -p0: PROPERTY {releasedDate} +v0: RESOURCE {Berlin} +p1: CLASS {area code} +p2: PROPERTY {} ***************************************************************** -Which people were born in Heraklion? +Which countries have more than two official languages? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?x WHERE { - ?x rdf:type ?p0 . +SELECT ?x COUNT(?v0) AS ?c WHERE { + ?v0 ?p0 ?j . ?x ?p1 ?y . + ?x rdf:type ?p3 . + ?v0 rdf:type ?p2 . + FILTER(?c > 2) . } >> SLOTS: -y: RESOURCE {Heraklion} -p0: CLASS {people} -p1: PROPERTY {born} +p0: PROPERTY {official} +p1: PROPERTY {have} +p2: CLASS {languages,language} +p3: CLASS {countries,state,nation,country,land} ***************************************************************** -Which caves have more than 3 entrances? +Who is the owner of Universal Studios? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?x COUNT(?v0) AS ?c WHERE { - ?x rdf:type ?p0 . - ?x ?p1 ?y . - ?v0 rdf:type ?p2 . - FILTER(?c > 3) . +SELECT ?y WHERE { + ?y rdf:type ?p2 . + ?y ?p1 ?v0 . } >> SLOTS: -p0: CLASS {caves,cave} -p1: PROPERTY {have} -p2: CLASS {entrances,entrance,entranceway,entryway,entry} -***************************************************************** -Give me all films produced by Hal Roach. +v0: RESOURCE {Universal Studios} +p1: PROPERTY {} +p2: CLASS {owner,proprietor} >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?y WHERE { - ?y rdf:type ?p1 . - ?v1 ?p0 ?y . + ?v0 ?p0 ?y . } >> SLOTS: -p0: PROPERTY {produced} -p1: CLASS {films,movie,film,picture,pic} +v0: RESOURCE {Universal Studios} +p0: PROPERTY {owner,proprietor} ***************************************************************** -Which software has been published by Mean Hamster Software? +When did Germany join the EU? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> +SELECT ?z WHERE { + ?x ?p1 ?z . + ?x ?p0 ?y . +} + +>> SLOTS: +y: RESOURCE {EU} +x: RESOURCE {Germany} +p0: PROPERTY {join} +p1: PROPERTY {date} +***************************************************************** +Which monarchs of the United Kingdom were married to a German? +>> QUERY: + +PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> + SELECT ?x WHERE { - ?x rdf:type ?p1 . - ?y ?p0 ?x . + ?v0 ?p1 ?x . + ?x ?p0 ?y . } >> SLOTS: -y: RESOURCE {Mean Hamster Software} -p0: PROPERTY {published} -p1: CLASS {software,package} +y: RESOURCE {German} +v0: RESOURCE {United Kingdom} +p0: PROPERTY {married} +p1: PROPERTY {monarchs,sovereign,monarch} +>> QUERY: + +PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> + +SELECT ?x WHERE { + ?x ?p4 ?v0 . + ?x ?p2 ?y . + ?x rdf:type ?p3 . +} + +>> SLOTS: +y: RESOURCE {German} +v0: RESOURCE {United Kingdom} +p2: PROPERTY {married} +p3: CLASS {monarchs,sovereign,monarch} +p4: PROPERTY {} ***************************************************************** -What languages are spoken in Estonia? +What is the highest mountain in Germany? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?y WHERE { +SELECT ?j ?y WHERE { + ?y ?p1 ?v1 . + ?y ?p2 ?j . ?y rdf:type ?p0 . - ?y ?p1 ?v0 . } +ORDER BY DESC(?j) +LIMIT 1 OFFSET 0 >> SLOTS: -v0: RESOURCE {Estonia} -p0: CLASS {languages,language} -p1: PROPERTY {spoken} +v1: RESOURCE {Germany} +p0: CLASS {mountain,mount} +p1: PROPERTY {} +p2: PROPERTY {highestdegree} ***************************************************************** -Who owns Aldi? +Give me all soccer clubs in Spain. >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?x WHERE { - ?x ?p0 ?y . +SELECT ?y WHERE { + ?y ?p1 ?v1 . + ?y rdf:type ?p0 . } >> SLOTS: -y: RESOURCE {Aldi} -p0: PROPERTY {owns} +v1: RESOURCE {Spain} +p0: CLASS {soccer clubs} +p1: PROPERTY {} ***************************************************************** -Who is called Dana? +What are the official languages of the Philippines? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?y WHERE { - ?y ?p0 'dana' . + ?v0 ?p1 ?y . + ?y ?p0 ?j . } >> SLOTS: -p0: PROPERTY {title,name} -***************************************************************** -Which books were written by Danielle Steel? +v0: RESOURCE {Philippines} +p0: PROPERTY {official} +p1: PROPERTY {languages,language} >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?x WHERE { - ?x rdf:type ?p1 . - ?y ?p0 ?x . +SELECT ?y WHERE { + ?y ?p4 ?v0 . + ?y ?p2 ?j . + ?y rdf:type ?p3 . } >> SLOTS: -y: RESOURCE {Danielle Steel} -p0: PROPERTY {written} -p1: CLASS {books,book} +v0: RESOURCE {Philippines} +p2: PROPERTY {official} +p3: CLASS {languages,language} +p4: PROPERTY {} ***************************************************************** -Which companies are located in California, USA? +Who is the mayor of New York City? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> @@ -602,69 +710,57 @@ SELECT ?y WHERE { ?y rdf:type ?p1 . - ?y ?p0 ?v0 . + ?y ?p2 ?v0 . } >> SLOTS: -v0: RESOURCE {California USA} -p0: PROPERTY {located} -p1: CLASS {companies,company} -***************************************************************** -Which country has the most official languages? +v0: RESOURCE {New York City} +p1: CLASS {mayor} +p2: PROPERTY {} >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?j ?x WHERE { - ?x rdf:type ?p0 . - ?y ?p1 ?j . - ?y rdf:type ?p2 . - ?x ?p3 ?y . +SELECT ?y WHERE { + ?v0 ?p0 ?y . } -ORDER BY DESC(?j) -LIMIT 1 OFFSET 0 >> SLOTS: -p0: CLASS {country,state,nation,land,commonwealth} -p1: PROPERTY {} -p2: CLASS {languages,language} -p3: PROPERTY {has} +v0: RESOURCE {New York City} +p0: PROPERTY {mayor} ***************************************************************** -Who produced films starring Natalie Portman? +Who designed the Brooklyn Bridge? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?x WHERE { - ?x ?p1 ?y . - ?y rdf:type ?p0 . - ?y ?p2 ?v1 . + ?x ?p0 ?y . } >> SLOTS: -v1: RESOURCE {Natalie Portman} -p0: CLASS {films,movie,film,picture,pic} -p1: PROPERTY {produced} -p2: PROPERTY {starring} +y: RESOURCE {Brooklyn Bridge} +p0: PROPERTY {designed} ***************************************************************** -Give me all movies with Tom Cruise! +Which telecommunications organizations are located in Belgium? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?y WHERE { - ?y rdf:type ?p1 . - ?y ?p0 ?v1 . + ?y rdf:type ?p0 . + ?y ?p1 ?v0 . } >> SLOTS: -p0: PROPERTY {} -p1: CLASS {movies,movie,film,picture,pic} +v0: RESOURCE {Belgium} +p0: CLASS {telecommunications organizations} +p1: PROPERTY {located} ***************************************************************** -Give me all female German chancellors! +What is the profession of Frank Herbert? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> @@ -672,58 +768,104 @@ SELECT ?y WHERE { ?y rdf:type ?p1 . - ?y ?p2 ?j . - ?y ?p0 ?v0 . + ?y ?p2 ?v0 . } >> SLOTS: -p0: PROPERTY {} -p1: CLASS {chancellors,Chancellor} +v0: RESOURCE {Frank Herbert} +p1: CLASS {profession} p2: PROPERTY {} -***************************************************************** -Give me all soccer clubs in the Premier League. >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?y WHERE { - ?y rdf:type ?p1 . - ?y ?p0 ?v1 . + ?v0 ?p0 ?y . } >> SLOTS: -v1: RESOURCE {Premier League} -p0: PROPERTY {} -p1: CLASS {soccer clubs} +v0: RESOURCE {Frank Herbert} +p0: PROPERTY {profession} ***************************************************************** -When was Capcom founded? +What is the highest place of Karakoram? >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -SELECT ?y WHERE { - ?x ?p0 ?y . +SELECT ?j ?y WHERE { + ?y ?p2 ?v0 . + ?y ?p4 ?j . + ?y rdf:type ?p3 . } +ORDER BY DESC(?j) +LIMIT 1 OFFSET 0 >> SLOTS: -x: RESOURCE {Capcom} -p0: PROPERTY {foundedDate} -***************************************************************** -What is the highest mountain? +v0: RESOURCE {Karakoram} +p2: PROPERTY {} +p3: CLASS {place,spot} +p4: PROPERTY {highestdegree} >> QUERY: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?j ?y WHERE { + ?v0 ?p0 ?y . ?y ?p1 ?j . - ?y rdf:type ?p0 . } ORDER BY DESC(?j) LIMIT 1 OFFSET 0 >> SLOTS: -p0: CLASS {mountain,mount} -p1: PROPERTY {degree} +v0: RESOURCE {Karakoram} +p0: PROPERTY {place,spot} +p1: PROPERTY {highestdegree} +***************************************************************** +Give me the homepage of Forbes. +>> QUERY: + +PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> + +SELECT ?y WHERE { + ?v0 ?p0 ?y . +} + +>> SLOTS: +v0: RESOURCE {Forbes} +p0: PROPERTY {homepage} +>> QUERY: + +PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> + +SELECT ?y WHERE { + ?y rdf:type ?p1 . + ?y ?p2 ?v0 . +} + +>> SLOTS: +v0: RESOURCE {Forbes} +p1: CLASS {homepage} +p2: PROPERTY {} +***************************************************************** +Which companies are in the computer software industry? +>> QUERY: + +PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> + +SELECT ?v0 WHERE { + ?v0 rdf:type ?p0 . + ?v0 rdf:type ?p2 . + ?v0 rdf:type ?p1 . + FILTER(?v0 == ?v0) . +} + +>> SLOTS: +p0: CLASS {industry} +p1: CLASS {computer software,software,package} +p2: CLASS {companies,company} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |