Skip to content

Commit fd54c7e

Browse files
Merge branch 'develop' of github.com:SmartDataAnalytics/DL-Learner into develop
2 parents 5b09c88 + 67bd473 commit fd54c7e

26 files changed

Lines changed: 225 additions & 202 deletions

File tree

README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ is needed.
66
Website: http://dl-learner.org
77
Bugs & Feature Requests: https://github.com/SmartDataAnalytics/DL-Learner/issues
88
Mailing Lists: [DL-Learner Discussion](https://www.freelists.org/list/dl-learner-discussion)
9-
Latest Release: https://github.com/AKSW/DL-Learner/releases
9+
Latest Release: https://github.com/SmartDataAnalytics/DL-Learner/releases
1010

1111
Documentation for DL-Learner:
1212
* please visit http://dl-learner.org for general information

components-core/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
<plugin>
6262
<groupId>org.codehaus.mojo</groupId>
6363
<artifactId>license-maven-plugin</artifactId>
64-
<version>1.14</version>
6564
<configuration>
6665
<licenseName>gpl_v3</licenseName>
6766
<organizationName>AKSW</organizationName>
@@ -114,7 +113,7 @@
114113
/&gt;Copyright &amp;#169; 2007-2016 Jens Lehmann</bottom>
115114
<encoding>ISO-8859-1</encoding>
116115
<windowtitle>DL-Learner Javadoc</windowtitle>
117-
<additionalparam>-Xdoclint:none</additionalparam>
116+
<doclint>none</doclint>
118117
</configuration>
119118
</plugin>
120119
</plugins>

components-core/src/main/java/org/dllearner/algorithms/qtl/filters/Filters.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static List<String> getFOAFFilterProperties(){
6969
filters.add(FOAF.homepage.toString());
7070
filters.add(FOAF.depiction.toString());
7171
filters.add(FOAF.Image.toString());
72-
filters.add(FOAF.surname.toString());
72+
filters.add(FOAF.familyName.toString());
7373
filters.add(FOAF.birthday.toString());
7474
filters.add(FOAF.name.toString());
7575
filters.add(FOAF.firstName.toString());

components-core/src/main/java/org/dllearner/algorithms/qtl/util/filters/PredicateExistenceFilterDBpedia.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ private void analyze() {
106106
sb.append(p).append("\n");
107107
}
108108
try {
109-
Files.write(sb.toString(), new File("dbpedia_meaningless_properties.txt"), Charsets.UTF_8);
109+
Files.asCharSink(new File("dbpedia_meaningless_properties.txt"), Charsets.UTF_8).write(sb.toString());
110110
} catch (IOException e) {
111111
e.printStackTrace();
112112
}

components-core/src/main/java/org/dllearner/kb/dataset/AbstractOWLOntologyDataset.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,7 @@ protected File downloadFile(URL url){
294294
}
295295

296296
private void add403Error(URL url){
297-
try {
298-
Files.append(url.toString() + "\n", new File(directory, "403.txt"), Charset.defaultCharset());
299-
} catch (IOException e) {
300-
e.printStackTrace();
301-
}
297+
org.dllearner.utilities.Files.appendToFile(new File(directory, "403.txt"), url.toString() + "\n");
302298
}
303299

304300
@Override

components-core/src/main/java/org/dllearner/kb/repository/bioportal/BioPortalRepository.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.apache.log4j.Logger;
2929
import org.dllearner.kb.repository.OntologyRepository;
3030
import org.dllearner.kb.repository.OntologyRepositoryEntry;
31+
import org.dllearner.utilities.Files;
3132
import org.semanticweb.owlapi.apibinding.OWLManager;
3233
import org.semanticweb.owlapi.model.*;
3334

@@ -236,10 +237,8 @@ public static void main(String[] args) throws Exception{
236237
System.out.println(entry.getOntologyShortName() + ": " + FileUtils.byteCountToDisplaySize(f.length()));
237238
map.put(entry.getOntologyShortName(), FileUtils.byteCountToDisplaySize(f.length()));
238239
} catch (Exception e) {
239-
com.google.common.io.Files.write(
240-
ExceptionUtils.getMessage(e),
241-
new File(downloadFailedDir, entry.getOntologyShortName() + ".txt"),
242-
Charsets.UTF_8);
240+
com.google.common.io.Files.asCharSink(new File(downloadFailedDir, entry.getOntologyShortName() + ".txt"),
241+
Charsets.UTF_8).write(ExceptionUtils.getMessage(e));
243242
return;
244243
}
245244
}
@@ -267,24 +266,24 @@ public static void main(String[] args) throws Exception{
267266
OWLOntology ont = man.loadOntologyFromOntologyDocument(f);
268267
System.out.println("#Axioms: " + ont.getLogicalAxiomCount());
269268

270-
com.google.common.io.Files.write(
269+
com.google.common.io.Files.asCharSink(
270+
new File(parsedSuccessfulDir, entry.getOntologyShortName() + ".txt"),
271+
Charsets.UTF_8).write(
271272
ont.getLogicalAxiomCount() + "\t" +
272273
ont.getClassesInSignature().size() + "\t" +
273274
ont.getObjectPropertiesInSignature().size() + "\t" +
274275
ont.getDataPropertiesInSignature().size() + "\t" +
275-
ont.getIndividualsInSignature().size(),
276-
new File(parsedSuccessfulDir, entry.getOntologyShortName() + ".txt"),
277-
Charsets.UTF_8);
276+
ont.getIndividualsInSignature().size()
277+
);
278278

279279
map.replace(entry.getOntologyShortName(), map.get(entry.getOntologyShortName()) + "||#Axioms: " + ont.getLogicalAxiomCount());
280280
man.removeOntology(ont);
281281
} catch (Exception e1) {
282282
System.err.println("Failed to parse " + entry.getOntologyShortName());
283283
map.replace(entry.getOntologyShortName(), map.get(entry.getOntologyShortName()) + "||Parse Error");
284-
com.google.common.io.Files.write(
285-
ExceptionUtils.getMessage(e1),
284+
com.google.common.io.Files.asCharSink(
286285
new File(parsedFailedDir, entry.getOntologyShortName() + ".txt"),
287-
Charsets.UTF_8);
286+
Charsets.UTF_8).write(ExceptionUtils.getMessage(e1));
288287
}
289288
}
290289
} catch (Exception e) {

components-core/src/main/java/org/dllearner/kb/sparql/ClassBasedSampleGenerator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public void setMaxNrOfPosExamples(int maxNrOfPosExamples) {
106106
public void setMaxNrOfNegExamples(int maxNrOfNegExamples) {
107107
this.maxNrOfNegExamples = maxNrOfNegExamples;
108108
}
109-
109+
110110
/**
111111
* @param useNegExamples whether to use negative examples or not
112112
*/
@@ -138,7 +138,7 @@ public Set<OWLIndividual> getNegativeExamples() {
138138
public void setSeed(long seed) {
139139
rnd.setSeed(seed);
140140
}
141-
141+
142142
private Set<OWLIndividual> computePosExamples(OWLClass cls) {
143143
List<OWLIndividual> posExamples = new ArrayList<>();
144144

components-core/src/main/java/org/dllearner/utilities/Files.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@
3030
import java.io.ObjectInputStream;
3131
import java.io.ObjectOutputStream;
3232
import java.net.URL;
33+
import java.nio.charset.Charset;
3334
import java.util.ArrayList;
3435
import java.util.List;
3536
import java.util.StringTokenizer;
3637

38+
import com.google.common.io.FileWriteMode;
3739
import org.slf4j.Logger;
3840
import org.slf4j.LoggerFactory;
3941

@@ -171,7 +173,7 @@ public static void createFile(File file, String content) {
171173
File parentFile = file.getParentFile();
172174
if (parentFile != null) { parentFile.mkdirs(); }
173175
try {
174-
com.google.common.io.Files.write(content, file, Charsets.UTF_8);
176+
com.google.common.io.Files.asCharSink(file, Charsets.UTF_8).write(content);
175177
} catch (IOException e) {
176178
logger.error("Failed to write content to file " + file, e);
177179
}
@@ -187,11 +189,23 @@ public static void createFile(File file, String content) {
187189
*/
188190
public static void appendToFile(File file, String content) {
189191
try {
190-
com.google.common.io.Files.append(content, file, Charsets.UTF_8);
192+
com.google.common.io.Files.asCharSink(file, Charsets.UTF_8, FileWriteMode.APPEND).write(content);
191193
} catch (IOException e) {
192194
logger.error("Failed to append content to file " + file, e);
193195
}
194196
}
197+
198+
/**
199+
* Write content to a file.
200+
*
201+
* @param file
202+
* The file to create.
203+
* @param content
204+
* Content of the file.
205+
*/
206+
public static void writeToFile(String content, File file) throws IOException {
207+
java.nio.file.Files.write(file.toPath(), content.getBytes());
208+
}
195209

196210
public static void clearFile(File file) {
197211
try{

components-core/src/main/java/org/dllearner/utilities/QueryUtils.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import org.apache.jena.sparql.util.VarUtils;
4242
import org.apache.jena.vocabulary.RDF;
4343
import org.dllearner.kb.sparql.CBDStructureTree;
44-
import org.jgrapht.DirectedGraph;
4544
import org.jgrapht.ext.JGraphXAdapter;
4645
import org.jgrapht.graph.DefaultDirectedGraph;
4746
import org.jgrapht.graph.DefaultEdge;
@@ -722,12 +721,12 @@ public void filterOutGeneralTypes(QueryExecutionFactory qef, Query query){
722721
}
723722
}
724723

725-
public static DirectedGraph<Node, LabeledEdge> asJGraphT(Query query) {
724+
public static DefaultDirectedGraph<Node, LabeledEdge> asJGraphT(Query query) {
726725
QueryUtils utils = new QueryUtils();
727726

728727
Set<Triple> tps = utils.extractTriplePattern(query);
729728

730-
DirectedGraph<Node, LabeledEdge> g = new DefaultDirectedGraph<>(LabeledEdge.class);
729+
DefaultDirectedGraph<Node, LabeledEdge> g = new DefaultDirectedGraph<>(LabeledEdge.class);
731730

732731
tps.forEach(tp -> {
733732
g.addVertex(tp.getSubject());
@@ -739,7 +738,7 @@ public static DirectedGraph<Node, LabeledEdge> asJGraphT(Query query) {
739738
}
740739

741740
public static void exportAsGraph(Query query, File file) {
742-
DirectedGraph<Node, LabeledEdge> g = asJGraphT(query);
741+
DefaultDirectedGraph<Node, LabeledEdge> g = asJGraphT(query);
743742
System.out.println(g.edgeSet().size());
744743

745744
JGraphXAdapter adapter = new JGraphXAdapter(g);

components-core/src/main/java/org/dllearner/utilities/owl/OWL2SPARULConverter.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.util.Collection;
3232
import java.util.Collections;
3333
import java.util.List;
34+
import java.util.Map;
3435
import java.util.concurrent.atomic.AtomicInteger;
3536

3637
import static org.semanticweb.owlapi.util.OWLAPIPreconditions.checkNotNull;
@@ -47,13 +48,13 @@ public class OWL2SPARULConverter
4748

4849
public OWL2SPARULConverter(OWLOntologyManager manager,
4950
OWLOntology ontology, boolean useStrongTyping, IndividualAppearance individualAppearance,
50-
AxiomAppearance axiomAppearance, AtomicInteger nextNode) {
51-
super(manager, ontology, useStrongTyping, individualAppearance, axiomAppearance, nextNode);
51+
AxiomAppearance axiomAppearance, AtomicInteger nextNode, Map<Object, Integer> blankNodeMap) {
52+
super(manager, ontology, useStrongTyping, individualAppearance, axiomAppearance, nextNode, blankNodeMap);
5253
}
5354

5455
public OWL2SPARULConverter(OWLOntology ontology, boolean useStrongTyping) {
5556
this(ontology.getOWLOntologyManager(), ontology, useStrongTyping,
56-
new OWLAnonymousIndividualsWithMultipleOccurrences(), new AlwaysOutputId(), new AtomicInteger());
57+
new OWLAnonymousIndividualsWithMultipleOccurrences(), new AlwaysOutputId(), new AtomicInteger(), Collections.emptyMap());
5758
}
5859

5960
/**

0 commit comments

Comments
 (0)