From: <lor...@us...> - 2012-06-11 13:07:08
|
Revision: 3731 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3731&view=rev Author: lorenz_b Date: 2012-06-11 13:06:58 +0000 (Mon, 11 Jun 2012) Log Message: ----------- Changed query to get URIs for property label. Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/common/index/SPARQLPropertiesIndex.java trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/TBSLTest.java Modified: trunk/components-ext/src/main/java/org/dllearner/common/index/SPARQLPropertiesIndex.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/common/index/SPARQLPropertiesIndex.java 2012-06-11 12:38:21 UTC (rev 3730) +++ trunk/components-ext/src/main/java/org/dllearner/common/index/SPARQLPropertiesIndex.java 2012-06-11 13:06:58 UTC (rev 3731) @@ -16,8 +16,8 @@ "LIMIT %d OFFSET %d"; super.queryWithLabelTemplate = "PREFIX owl:<http://www.w3.org/2002/07/owl#> SELECT DISTINCT * WHERE {\n" + -// "?s ?uri ?o.\n" + - "{?uri a owl:DatatypeProperty.} UNION {?uri a owl:ObjectProperty.} " + + "?s ?uri ?o.\n" + +// "{?uri a owl:DatatypeProperty.} UNION {?uri a owl:ObjectProperty.} " + "?uri <http://www.w3.org/2000/01/rdf-schema#label> ?label\n" + "FILTER(REGEX(STR(?label), '%s', 'i'))}\n" + "LIMIT %d OFFSET %d"; Modified: trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/TBSLTest.java =================================================================== --- trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/TBSLTest.java 2012-06-11 12:38:21 UTC (rev 3730) +++ trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/TBSLTest.java 2012-06-11 13:06:58 UTC (rev 3731) @@ -41,18 +41,6 @@ } catch (FileNotFoundException e) { e.printStackTrace(); } - System.out.println(model.size()); - String queryStr = "PREFIX owl:<http://www.w3.org/2002/07/owl#> SELECT DISTINCT ?uri WHERE {" + -// "?s ?uri ?o." + - "{?uri a owl:DatatypeProperty.} UNION {?uri a owl:ObjectProperty.}" + - "?uri <http://www.w3.org/2000/01/rdf-schema#label> ?label." + - "FILTER(REGEX(STR(?label), 'bathroom', 'i'))" + - "}" + - "LIMIT 20 OFFSET 0"; - System.out.println( - ResultSetFormatter.asText( - QueryExecutionFactory.create( - QueryFactory.create(queryStr, Syntax.syntaxARQ), model).execSelect())); } @Test @@ -100,11 +88,12 @@ Index resourcesIndex = new SPARQLIndex(endpoint); Index classesIndex = new SPARQLClassesIndex(endpoint); Index propertiesIndex = new SPARQLPropertiesIndex(endpoint); + System.out.println(propertiesIndex.getResources("near")); SPARQLTemplateBasedLearner2 learner = new SPARQLTemplateBasedLearner2(endpoint, resourcesIndex, classesIndex, propertiesIndex); learner.init(); - String question = "Give me all houses with more than 2 bedrooms and more than 3 bathrooms."; + String question = "Give me all houses near a school."; learner.setQuestion(question); learner.learnSPARQLQueries(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |