Skip to content

Commit

Permalink
Core: Normalise paths for Trident data sources
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarx committed Sep 3, 2020
1 parent 9877e6d commit c087f05
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.semanticweb.rulewerk.core.reasoner.implementation;

import java.io.File;

/*-
* #%L
* Rulewerk Core Components
Expand Down Expand Up @@ -46,16 +48,23 @@ public class TridentDataSource implements ReasonerDataSource {
public static final String declarationPredicateName = "trident";

final String filePath;
final String fileName;

public TridentDataSource(final String filePath) {
Validate.notBlank(filePath, "Path to Trident database cannot be blank!");
this.filePath = filePath;
this.filePath = filePath; // unmodified file path, necessary for correct serialisation
this.fileName = new File(filePath).getName();
}

public String getPath() {
return this.filePath;
}

public String getName() {
return this.fileName;
}


@Override
public Fact getDeclarationFact() {
Predicate predicate = Expressions.makePredicate(declarationPredicateName, 1);
Expand All @@ -65,7 +74,7 @@ public Fact getDeclarationFact() {

@Override
public String toString() {
return "[TridentDataSource [tridentFile=" + this.filePath + "]";
return "[TridentDataSource [tridentFile=" + this.fileName + "]";
}

@Override
Expand All @@ -90,7 +99,7 @@ public boolean equals(final Object obj) {
return false;
}
final TridentDataSource other = (TridentDataSource) obj;
return this.filePath.equals(other.getPath());
return this.fileName.equals(other.getName());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void visit(SparqlQueryResultDataSource dataSource) {
public void visit(TridentDataSource dataSource) {
this.configString = PREDICATE_NAME_CONFIG_LINE + DATASOURCE_TYPE_CONFIG_PARAM + "=" //
+ TRIDENT_DATASOURCE_TYPE_CONFIG_VALUE + "\n" //
+ "EDB%1$d_param0=" + dataSource.getPath() + "\n";
+ "EDB%1$d_param0=" + dataSource.getName() + "\n";
}

@Override
Expand Down

0 comments on commit c087f05

Please sign in to comment.