Skip to content

Commit 93d34f3

Browse files
committed
fix enrichment parameter link
1 parent d2ccc95 commit 93d34f3

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

interfaces/src/main/java/org/dllearner/cli/Enrichment.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -654,13 +654,15 @@ private List<OWLAxiom> toRDF(List<EvaluatedAxiom<OWLAxiom>> evalAxioms, Class<?
654654
//add Parameters to algorithm run instance
655655
OWLIndividual paramInd;
656656
for(Entry<Field, Object> entry : parameters.entrySet()){
657-
paramInd = f.getOWLNamedIndividual(IRI.create(generateId()));
657+
paramInd = f.getOWLNamedIndividual(IRI.create(defaultNamespace+generateId()));
658658
ax = f.getOWLClassAssertionAxiom(EnrichmentVocabulary.Parameter, paramInd);
659659
axioms.add(ax);
660660
ax = f.getOWLDataPropertyAssertionAxiom(EnrichmentVocabulary.parameterName, paramInd, AnnComponentManager.getName(entry.getKey()));
661661
axioms.add(ax);
662662
ax = f.getOWLDataPropertyAssertionAxiom(EnrichmentVocabulary.parameterValue, paramInd, entry.getValue().toString());
663663
axioms.add(ax);
664+
ax = f.getOWLObjectPropertyAssertionAxiom(EnrichmentVocabulary.hasParameter, algorithmRunInd, paramInd);
665+
axioms.add(ax);
664666
}
665667
//add timestamp
666668
ax = f.getOWLDataPropertyAssertionAxiom(EnrichmentVocabulary.timestamp, algorithmRunInd, System.currentTimeMillis());
@@ -814,7 +816,7 @@ private void filter(Model model) {
814816

815817
Model getModel(List<OWLAxiom> axioms) {
816818
try {
817-
OWLOntology ontology = OWLManager.createOWLOntologyManager().createOntology(new HashSet<>(axioms));
819+
OWLOntology ontology = OWLManager.createOWLOntologyManager().createOntology(new HashSet<>(axioms), IRI.create(DEFAULT_NS + generateId()));
818820
Model model = OwlApiJenaUtils.getModel(ontology);
819821
model.setNsPrefix("enr", "http://www.dl-learner.org/enrichment.owl#");
820822
return model;
@@ -824,19 +826,19 @@ Model getModel(List<OWLAxiom> axioms) {
824826
return null;
825827
}
826828

827-
public OWLOntology getGeneratedOntology(){
829+
public OWLOntology getGeneratedOntology(URI uri){
828830
OWLOntology ontology = null;
829831
try {
830832
OWLOntologyManager man = OWLManager.createOWLOntologyManager();
831-
ontology = man.createOntology(learnedOWLAxioms);
833+
ontology = man.createOntology(learnedOWLAxioms, IRI.create(uri));
832834
} catch (OWLOntologyCreationException e) {
833835
// TODO Auto-generated catch block
834836
e.printStackTrace();
835837
}
836838
return ontology;
837839
}
838840

839-
public OWLOntology getGeneratedOntology(boolean withConfidenceAsAnnotations){
841+
public OWLOntology getGeneratedOntology(boolean withConfidenceAsAnnotations, URI uri){
840842
OWLOntology ontology = null;
841843
try {
842844
OWLOntologyManager man = OWLManager.createOWLOntologyManager();
@@ -853,7 +855,7 @@ public OWLOntology getGeneratedOntology(boolean withConfidenceAsAnnotations){
853855
}
854856
axioms.add(ax);
855857
}
856-
ontology = man.createOntology(axioms);
858+
ontology = man.createOntology(axioms, IRI.create(uri));
857859

858860
} catch (OWLOntologyCreationException e) {
859861
e.printStackTrace();
@@ -867,7 +869,7 @@ public OWLOntology getGeneratedOntology(boolean withConfidenceAsAnnotations){
867869
private void printTurtleSyntax(List<OWLAxiom> axioms){
868870
try {
869871
System.out.println("ENRICHMENT[");
870-
Model model = OwlApiJenaUtils.getModel(OWLManager.createOWLOntologyManager().createOntology(new HashSet<>(axioms)));
872+
Model model = OwlApiJenaUtils.getModel(OWLManager.createOWLOntologyManager().createOntology(new HashSet<>(axioms), IRI.create("http://localhost:8080/" + generateId())));
871873
model.write(System.out, "TURTLE");
872874
System.out.println("]");
873875
} catch (OWLOntologyCreationException e) {
@@ -882,7 +884,7 @@ private void printTurtleSyntax(List<OWLAxiom> axioms){
882884
private void printNTriplesSyntax(List<OWLAxiom> axioms){
883885
try {
884886
System.out.println("ENRICHMENT[");
885-
Model model = OwlApiJenaUtils.getModel(OWLManager.createOWLOntologyManager().createOntology(new HashSet<>(axioms)));
887+
Model model = OwlApiJenaUtils.getModel(OWLManager.createOWLOntologyManager().createOntology(new HashSet<>(axioms), IRI.create("http://localhost:8080/" + generateId())));
886888
model.write(System.out, "N-TRIPLES");
887889
System.out.println("]");
888890
} catch (OWLOntologyCreationException e) {
@@ -1172,7 +1174,7 @@ protected PasswordAuthentication getPasswordAuthentication() {
11721174
if(options.has("s")){
11731175
File file = (File)options.valueOf("s");
11741176
try {
1175-
OWLOntology ontology = e.getGeneratedOntology(options.has("a"));
1177+
OWLOntology ontology = e.getGeneratedOntology(options.has("a"), file.toURI());
11761178
OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
11771179
OWLManager.createOWLOntologyManager().saveOntology(ontology, new RDFXMLDocumentFormat(), os);
11781180
} catch (OWLOntologyStorageException e1) {

interfaces/src/main/java/org/dllearner/cli/GlobalEnrichment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public void run() {
236236
List<OWLAxiom> axioms = new LinkedList<>();
237237
int axiomCnt = 0;
238238
for(AlgorithmRun run : runs) {
239-
axiomCnt += e.getGeneratedOntology().getLogicalAxiomCount();
239+
axiomCnt += e.getGeneratedOntology(f.toURI()).getLogicalAxiomCount();
240240
axioms.addAll(e.toRDF(run.getAxioms(), run.getAlgorithm(), run.getParameters(), ks));
241241
}
242242
Model model = e.getModel(axioms);

0 commit comments

Comments
 (0)