Skip to content

Commit

Permalink
Merge branch 'release/1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickwestphal committed Oct 6, 2016
2 parents fda45f9 + 43fe69c commit 75de669
Show file tree
Hide file tree
Showing 635 changed files with 359,766 additions and 13,104 deletions.
3 changes: 2 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Documentation for DL-Learner:
* Javadoc: http://dl-learner.org/javadoc

DL-Learner is Open Source and licensed under the GNU General Public License 3.
(Copyright (c) 2007-2015, Jens Lehmann).
(Copyright (c) 2007-2016, Jens Lehmann).

DL-Learner uses several other libraries. An incomplete list is as follows:
* OWL API (licensed under LGPL)
Expand All @@ -26,3 +26,4 @@ DL-Learner uses several other libraries. An incomplete list is as follows:

Use DL-Learner in other tools:
* Protégé (http://dl-learner.org/community/protege-plugin/)
* ORE (http://ore-tool.net/)
4 changes: 2 additions & 2 deletions buildRelease.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# This script builds the DL-LEarner project and creates the Zip and Tarball file
# which contains the command line interface 'cli' and 'enrichment'.
mvn -DskipTests=true -pl components-core,interfaces install
cd interfaces
mvn -DskipTests=true -pl components-core,interfaces,components-ext,interfaces-ext install
cd interfaces-ext
mvn -Prelease package -DskipTests=true
97 changes: 79 additions & 18 deletions components-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>org.dllearner</groupId>
<artifactId>dllearner-parent</artifactId>
<version>1.2</version>
<version>1.3.0</version>
</parent>

<profiles>
Expand Down Expand Up @@ -87,6 +87,9 @@
<configuration>
<header></header>
<show>public</show>
<links>
<link>https://docs.oracle.com/javase/8/docs/api/</link>
</links>
<nohelp>true</nohelp>
<destDir>doc/javadoc</destDir>
<doctitle>DL-Learner Javadoc</doctitle>
Expand All @@ -108,7 +111,7 @@
src='https://raw.githubusercontent.com/github/media/master/octocats/blacktocat-16.png'
border='0' alt='Github.com Logo' /&gt; DL-Learner is licenced
under the terms of the GNU General Public License.&lt;br
/&gt;Copyright &amp;#169; 2007-2015 Jens Lehmann</bottom>
/&gt;Copyright &amp;#169; 2007-2016 Jens Lehmann</bottom>
<encoding>ISO-8859-1</encoding>
<windowtitle>DL-Learner Javadoc</windowtitle>
<additionalparam>-Xdoclint:none</additionalparam>
Expand All @@ -125,21 +128,21 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Uncomment this when the junits are independent of a runtime directory -->
<!--<includes> -->
<!--<include>org/dllearner/test/junit/*</include> -->
<!--</includes> -->
<excludes>
<exclude>org/dllearner/test/*</exclude>
<exclude>org/dllearner/test/junit/TestOntologies.java</exclude>
<exclude>org/dllearner/test/junit/PropertyLearningTest.java</exclude>
<exclude>org/dllearner/test/junit/DisjointClassesLearningTest.java</exclude>
<!--This line excludes inner classes -->
<exclude>**/*$*</exclude>
</excludes>
<argLine>-Dlog4j.configuration=log4j.properties</argLine>
</configuration>
<!--<configuration>-->
<!--&lt;!&ndash; Uncomment this when the junits are independent of a runtime directory &ndash;&gt;-->
<!--&lt;!&ndash;<includes> &ndash;&gt;-->
<!--&lt;!&ndash;<include>org/dllearner/test/junit/*</include> &ndash;&gt;-->
<!--&lt;!&ndash;</includes> &ndash;&gt;-->
<!--<excludes>-->
<!--<exclude>org/dllearner/test/*</exclude>-->
<!--<exclude>org/dllearner/test/junit/TestOntologies.java</exclude>-->
<!--<exclude>org/dllearner/test/junit/PropertyLearningTest.java</exclude>-->
<!--<exclude>org/dllearner/test/junit/DisjointClassesLearningTest.java</exclude>-->
<!--&lt;!&ndash;This line excludes inner classes &ndash;&gt;-->
<!--<exclude>**/*$*</exclude>-->
<!--</excludes>-->
<!--<argLine>-Dlog4j.configuration=log4j.properties</argLine>-->
<!--</configuration>-->
</plugin>
<!-- Jar the tests up into a separate jar so other components tests' can
leverage them -->
Expand Down Expand Up @@ -192,6 +195,49 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<!--<configuration>-->
<!--<source>1.8</source>-->
<!--<target>1.8</target>-->
<!--</configuration>-->
<executions>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<configuration>
<testExcludes>
<exclude>**/QueryToGraphExporter.java</exclude>
</testExcludes>
</configuration>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- Code coverage -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.6.201602180812</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -425,6 +471,21 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
</dependency>

<!-- https://mvnrepository.com/artifact/org.jgrapht/jgrapht-ext -->
<dependency>
<groupId>org.jgrapht</groupId>
<artifactId>jgrapht-ext</artifactId>
<version>0.9.2</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.tinyjee.jgraphx/jgraphx -->
<dependency>
<groupId>org.tinyjee.jgraphx</groupId>
<artifactId>jgraphx</artifactId>
<version>3.4.1.3</version>
</dependency>

<!--
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down Expand Up @@ -469,7 +530,7 @@
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.9-RC1</version>
<version>0.9.10</version>
</dependency>


Expand Down
16 changes: 16 additions & 0 deletions components-core/src/main/java/org/dllearner/Constants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.dllearner;

/**
*
* @author Giuseppe Cota <giuseppe.cota@unife.it>
*/
public class Constants {

public enum State { RUNNING, OK, TIMEOUT, FAILURE, ERROR }

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
package org.dllearner.algorithms;

import com.google.common.collect.Sets;
import com.hp.hpl.jena.query.ParameterizedSparqlString;
import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import org.apache.jena.query.ParameterizedSparqlString;
import org.apache.jena.query.QueryExecution;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Statement;
import org.apache.jena.rdf.model.StmtIterator;
import org.aksw.jena_sparql_api.pagination.core.QueryExecutionFactoryPaginated;
import org.dllearner.algorithms.celoe.CELOE;
import org.dllearner.core.AbstractAxiomLearningAlgorithm;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,10 @@
*/
package org.dllearner.algorithms;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;

import org.dllearner.core.AbstractAxiomLearningAlgorithm;
import org.dllearner.core.ClassExpressionLearningAlgorithm;
import org.dllearner.core.ComponentAnn;
import org.dllearner.core.EvaluatedAxiom;
import org.dllearner.core.EvaluatedDescription;
import org.dllearner.core.Score;
import org.apache.jena.ontology.OntClass;
import org.apache.jena.ontology.OntModel;
import org.apache.jena.query.*;
import org.dllearner.core.*;
import org.dllearner.core.annotations.Unused;
import org.dllearner.core.config.ConfigOption;
import org.dllearner.core.owl.ClassHierarchy;
Expand All @@ -41,22 +30,12 @@
import org.dllearner.kb.sparql.SparqlEndpoint;
import org.dllearner.learningproblems.AxiomScore;
import org.dllearner.learningproblems.Heuristics;
import org.semanticweb.owlapi.model.AxiomType;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLClassExpression;
import org.semanticweb.owlapi.model.OWLDisjointClassesAxiom;
import org.semanticweb.owlapi.model.OWLIndividual;

import org.semanticweb.owlapi.model.*;
import uk.ac.manchester.cs.owl.owlapi.OWLClassImpl;

import com.hp.hpl.jena.ontology.OntClass;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.query.ParameterizedSparqlString;
import com.hp.hpl.jena.query.QuerySolution;
import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.query.ResultSetFactory;
import com.hp.hpl.jena.query.ResultSetRewindable;
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.Collectors;

/**
* Learns disjoint classes using SPARQL queries.
Expand Down Expand Up @@ -418,7 +397,7 @@ private void keepMostGeneralClasses(Set<OWLClass> classes) {
// for(OntClass cls : model.listOWLClasses().toSet()){
// Set<OntClass> superClasses = cls.listSuperClasses().toSet();
// if(superClasses.isEmpty() ||
// (superClasses.size() == 1 && superClasses.contains(model.getOntClass(com.hp.hpl.jena.vocabulary.OWL.Thing.getURI())))){
// (superClasses.size() == 1 && superClasses.contains(model.getOntClass(org.apache.jena.vocabulary.OWL.Thing.getURI())))){
// topClasses.add(df.getOWLClass(IRI.create(cls.getURI()));
// }
//
Expand Down Expand Up @@ -559,12 +538,10 @@ public Set<EvaluatedAxiom<OWLDisjointClassesAxiom>> computeDisjointness(Set<OWLC
}

public static Set<OWLClass> asOWLClasses(Set<OWLClassExpression> descriptions) {
Set<OWLClass> classes = new TreeSet<>();
for (OWLClassExpression description : descriptions) {
if (!description.isAnonymous()) {
classes.add(description.asOWLClass());
}
}
Set<OWLClass> classes = descriptions.stream()
.filter(description -> !description.isAnonymous())
.map(OWLClassExpression::asOWLClass)
.collect(Collectors.toCollection(TreeSet::new));
return classes;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public EvaluatedDescription getCurrentlyBestEvaluatedDescription() {
* @param length the length
*/
private void generateDescriptions(int length) {
generatedDescriptions.put(length, new ArrayList<OWLClassExpression>());
generatedDescriptions.put(length, new ArrayList<>());
List<OWLClassExpression> thisLenDescriptions = generatedDescriptions.get(length);

if (length == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,16 @@
*/
package org.dllearner.algorithms;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;

import org.dllearner.core.AbstractAxiomLearningAlgorithm;
import org.dllearner.core.ClassExpressionLearningAlgorithm;
import org.dllearner.core.ComponentAnn;
import org.dllearner.core.EvaluatedAxiom;
import org.dllearner.core.EvaluatedDescription;
import org.dllearner.core.Score;
import org.apache.jena.query.ParameterizedSparqlString;
import org.apache.jena.query.QuerySolution;
import org.apache.jena.query.ResultSet;
import org.dllearner.core.*;
import org.dllearner.kb.SparqlEndpointKS;
import org.dllearner.learningproblems.AxiomScore;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLClassExpression;
import org.semanticweb.owlapi.model.OWLIndividual;
import org.semanticweb.owlapi.model.OWLSubClassOfAxiom;
import org.semanticweb.owlapi.model.*;

import com.hp.hpl.jena.query.ParameterizedSparqlString;
import com.hp.hpl.jena.query.QuerySolution;
import com.hp.hpl.jena.query.ResultSet;
import java.util.*;
import java.util.Map.Entry;

/**
* Learns sub classes using SPARQL queries.
Expand All @@ -60,6 +44,8 @@ public class SimpleSubclassLearner extends AbstractAxiomLearningAlgorithm<OWLSub

public SimpleSubclassLearner(SparqlEndpointKS ks) {
this.ks = ks;

axiomType = AxiomType.SUBCLASS_OF;
}

@Override
Expand Down Expand Up @@ -114,7 +100,7 @@ public void start() {
*/
@Override
protected ParameterizedSparqlString getSampleQuery() {
return new ParameterizedSparqlString("CONSTRUCT{?s a ?entity . ?s a ?cls1 .} WHERE {?s a ?entity . OPTIONAL {?s a ?cls1 .}");
return new ParameterizedSparqlString("CONSTRUCT{?s a ?entity . ?s a ?cls1 .} WHERE {?s a ?entity . OPTIONAL {?s a ?cls1 . }");
}

/*
Expand Down Expand Up @@ -147,6 +133,7 @@ protected void getExistingAxioms() {
existingAxioms.add(df.getOWLSubClassOfAxiom(entityToDescribe, sup));
}
}

}

/*
Expand All @@ -163,8 +150,10 @@ private void runSingleQueryMode() {
int total = reasoner.getPopularity(entityToDescribe);

if (total > 0) {
String query = String
.format("SELECT ?type (COUNT(DISTINCT ?s) AS ?cnt) WHERE {?s a <%s>. ?s a ?type} GROUP BY ?type ORDER BY DESC(?cnt)",
String query = String.format(
"SELECT ?type (COUNT(DISTINCT ?s) AS ?cnt) WHERE {" +
"?s a <%s>. ?s a ?type . FILTER(?type != <http://www.w3.org/2002/07/owl#NamedIndividual>)} " +
"GROUP BY ?type ORDER BY DESC(?cnt)",
entityToDescribe.toStringID());
ResultSet rs = executeSelectQuery(query);
QuerySolution qs;
Expand All @@ -180,6 +169,11 @@ private void runSingleQueryMode() {
}
}
}

currentlyBestEvaluatedDescriptions.forEach(
ed -> currentlyBestAxioms.add(
new EvaluatedAxiom<>(df.getOWLSubClassOfAxiom(entityToDescribe, ed.getDescription()),
new AxiomScore(ed.getAccuracy()))));
}

public OWLClass getentityToDescribe() {
Expand Down Expand Up @@ -239,9 +233,9 @@ private void createEvaluatedDescriptions(Map<OWLIndividual, SortedSet<OWLClassEx
for (OWLClassExpression nc : entry.getValue()) {
Integer cnt = result.get(nc);
if (cnt == null) {
cnt = Integer.valueOf(1);
cnt = 1;
} else {
cnt = Integer.valueOf(cnt + 1);
cnt = cnt + 1;
}
result.put(nc, cnt);
}
Expand Down

0 comments on commit 75de669

Please sign in to comment.