From: <lor...@us...> - 2013-03-18 12:24:48
|
Revision: 3912 http://sourceforge.net/p/dl-learner/code/3912 Author: lorenz_b Date: 2013-03-18 12:24:44 +0000 (Mon, 18 Mar 2013) Log Message: ----------- Some updates. Modified Paths: -------------- trunk/components-core/pom.xml trunk/components-core/src/main/java/org/dllearner/algorithms/properties/DisjointObjectPropertyAxiomLearner.java trunk/components-core/src/main/java/org/dllearner/kb/sparql/ConciseBoundedDescriptionGenerator.java trunk/components-core/src/main/java/org/dllearner/kb/sparql/ExtractionDBCache.java trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlEndpoint.java trunk/components-core/src/main/java/org/dllearner/reasoning/SPARQLReasoner.java Modified: trunk/components-core/pom.xml =================================================================== --- trunk/components-core/pom.xml 2013-03-12 09:29:04 UTC (rev 3911) +++ trunk/components-core/pom.xml 2013-03-18 12:24:44 UTC (rev 3912) @@ -116,12 +116,23 @@ <dependency> <groupId>net.sourceforge.owlapi</groupId> <artifactId>owlapi-distribution</artifactId> + <version>3.4.4</version> </dependency> <dependency> <groupId>net.sourceforge.owlapi</groupId> <artifactId>owlapi-reasoner</artifactId> </dependency> <dependency> + <groupId>net.sourceforge.owlapi</groupId> + <artifactId>owlapi-debugging</artifactId> + <version>3.3</version> +</dependency> +<dependency> + <groupId>net.sourceforge.owlapi</groupId> + <artifactId>owlapi-modularity</artifactId> + <version>3.3</version> +</dependency> +<dependency> <groupId>net.sourceforge.owlapi</groupId> <artifactId>owlapi-util</artifactId> </dependency> @@ -135,6 +146,10 @@ <groupId>org.mortbay.jetty</groupId> <artifactId>org.mortbay.jetty</artifactId> </exclusion> + <exclusion> + <artifactId>owlapi</artifactId> + <groupId>net.sourceforge.owlapi</groupId> + </exclusion> </exclusions> </dependency> Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/properties/DisjointObjectPropertyAxiomLearner.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/properties/DisjointObjectPropertyAxiomLearner.java 2013-03-12 09:29:04 UTC (rev 3911) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/properties/DisjointObjectPropertyAxiomLearner.java 2013-03-18 12:24:44 UTC (rev 3912) @@ -116,7 +116,7 @@ //compute the overlap if exist Map<ObjectProperty, Integer> property2Overlap = new HashMap<ObjectProperty, Integer>(); String query = String.format("SELECT ?p (COUNT(*) AS ?cnt) WHERE {?s <%s> ?o. ?s ?p ?o.} GROUP BY ?p", propertyToDescribe.getName()); - ResultSet rs = executeSelectQuery(query); + System.out.println(query);ResultSet rs = executeSelectQuery(query); QuerySolution qs; while(rs.hasNext()){ qs = rs.next(); @@ -336,13 +336,13 @@ } public static void main(String[] args) throws Exception{ - SparqlEndpoint endpoint = SparqlEndpoint.getEndpointDBpedia(); + SparqlEndpoint endpoint = SparqlEndpoint.getEndpointDBpediaLiveAKSW(); // endpoint = new SparqlEndpoint(new URL("http://dbpedia.aksw.org:8902/sparql"), Collections.singletonList("http://dbpedia.org"), Collections.<String>emptyList())); DisjointObjectPropertyAxiomLearner l = new DisjointObjectPropertyAxiomLearner(new SparqlEndpointKS(endpoint));//.getEndpointDBpediaLiveAKSW())); l.setPropertyToDescribe(new ObjectProperty("http://dbpedia.org/ontology/league")); l.setMaxExecutionTimeInSeconds(10); l.init(); - l.getReasoner().precomputeObjectPropertyPopularity(); +// l.getReasoner().precomputeObjectPropertyPopularity(); l.start(); for(EvaluatedAxiom ax : l.getCurrentlyBestEvaluatedAxioms(Integer.MAX_VALUE)){ System.out.println(ax); Modified: trunk/components-core/src/main/java/org/dllearner/kb/sparql/ConciseBoundedDescriptionGenerator.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/kb/sparql/ConciseBoundedDescriptionGenerator.java 2013-03-12 09:29:04 UTC (rev 3911) +++ trunk/components-core/src/main/java/org/dllearner/kb/sparql/ConciseBoundedDescriptionGenerator.java 2013-03-18 12:24:44 UTC (rev 3912) @@ -13,4 +13,5 @@ public void setRestrictToNamespaces(List<String> namespaces); public void setRecursionDepth(int maxRecursionDepth); + } Modified: trunk/components-core/src/main/java/org/dllearner/kb/sparql/ExtractionDBCache.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/kb/sparql/ExtractionDBCache.java 2013-03-12 09:29:04 UTC (rev 3911) +++ trunk/components-core/src/main/java/org/dllearner/kb/sparql/ExtractionDBCache.java 2013-03-18 12:24:44 UTC (rev 3912) @@ -38,9 +38,9 @@ import com.hp.hpl.jena.query.ResultSetRewindable; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; -import com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP; import com.jamonapi.Monitor; import com.jamonapi.MonitorFactory; +//import com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP; /** * The class is used to cache information about resources to a database. Modified: trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlEndpoint.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlEndpoint.java 2013-03-12 09:29:04 UTC (rev 3911) +++ trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlEndpoint.java 2013-03-18 12:24:44 UTC (rev 3912) @@ -20,6 +20,7 @@ package org.dllearner.kb.sparql; import java.net.URL; +import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -49,6 +50,10 @@ this.namedGraphURIs=namedGraphURIs; } + public SparqlEndpoint(URL url, String defaultGraphURI) { + this(url, Collections.singletonList(defaultGraphURI), Collections.<String>emptyList()); + } + public URL getURL() { return this.url; } Modified: trunk/components-core/src/main/java/org/dllearner/reasoning/SPARQLReasoner.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/reasoning/SPARQLReasoner.java 2013-03-12 09:29:04 UTC (rev 3911) +++ trunk/components-core/src/main/java/org/dllearner/reasoning/SPARQLReasoner.java 2013-03-18 12:24:44 UTC (rev 3912) @@ -783,12 +783,34 @@ return isObjectProperty; } - public boolean isDataProperty(String propertyURI){ - String query = String.format("ASK {<%s> a <%s>}", propertyURI, OWL.DatatypeProperty.getURI()); + public boolean isObjectProperty(String propertyURI, boolean analyzeData){ + String query = String.format("ASK {<%s> a <%s>}", propertyURI, OWL.ObjectProperty.getURI()); boolean isObjectProperty = executeAskQuery(query); + if(!isObjectProperty && analyzeData){ + query = String.format("ASK {?s <%s> ?o.FILTER(isURI(?o))}", propertyURI); + isObjectProperty = executeAskQuery(query); + } return isObjectProperty; } + public boolean isDataProperty(String propertyURI){ + if(propertyURI.equals("http://www.w3.org/2000/01/rdf-schema#label")) return true; + String query = String.format("ASK {<%s> a <%s>}", propertyURI, OWL.DatatypeProperty.getURI()); + boolean isDataProperty = executeAskQuery(query); + return isDataProperty; + } + + public boolean isDataProperty(String propertyURI, boolean analyzeData){ + if(propertyURI.equals("http://www.w3.org/2000/01/rdf-schema#label")) return true; + String query = String.format("ASK {<%s> a <%s>}", propertyURI, OWL.DatatypeProperty.getURI()); + boolean isDataProperty = executeAskQuery(query); + if(!isDataProperty && analyzeData){ + query = String.format("ASK {?s <%s> ?o.FILTER(isLITERAL(?o))}", propertyURI); + isDataProperty = executeAskQuery(query); + } + return isDataProperty; + } + public int getIndividualsCount(NamedClass nc){ String query = String.format("SELECT (COUNT(?s) AS ?cnt) WHERE {" + "?s a <%s>." + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |