-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
115 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/java/at/ac/univie/mminf/qskos4j/issues/language/util/NoCommonLanguagesResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package at.ac.univie.mminf.qskos4j.issues.language.util; | ||
|
||
import at.ac.univie.mminf.qskos4j.result.Result; | ||
|
||
import java.io.BufferedWriter; | ||
import java.io.IOException; | ||
import java.util.Collection; | ||
|
||
public class NoCommonLanguagesResult extends Result<Collection<String>> { | ||
|
||
public NoCommonLanguagesResult(Collection<String> data) { | ||
super(data); | ||
} | ||
|
||
@Override | ||
protected void generateTextReport(BufferedWriter osw, ReportStyle style) throws IOException | ||
{ | ||
switch (style) { | ||
case SHORT: | ||
if (getData().isEmpty()) { | ||
osw.write("Concepts are not described in a common language"); | ||
} | ||
else { | ||
osw.write("At least one common language for text literals of all concepts has been found"); | ||
} | ||
break; | ||
|
||
case EXTENSIVE: | ||
if (!getData().isEmpty()) { | ||
osw.write("Common language(s) for all concepts: " +getData().toString()); | ||
} | ||
break; | ||
} | ||
} | ||
|
||
@Override | ||
public boolean isProblematic() { | ||
return getData().isEmpty(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 0 additions & 35 deletions
35
src/test/java/at/ac/univie/mminf/qskos4j/issues/CommonLanguagesTest.java
This file was deleted.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
src/test/java/at/ac/univie/mminf/qskos4j/issues/NoCommonLanguagesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package at.ac.univie.mminf.qskos4j.issues; | ||
|
||
import at.ac.univie.mminf.qskos4j.issues.concepts.InvolvedConcepts; | ||
import at.ac.univie.mminf.qskos4j.issues.language.NoCommonLanguages; | ||
import at.ac.univie.mminf.qskos4j.issues.language.util.LanguageCoverage; | ||
import at.ac.univie.mminf.qskos4j.util.vocab.RepositoryBuilder; | ||
import junit.framework.Assert; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.openrdf.OpenRDFException; | ||
|
||
import java.io.IOException; | ||
|
||
public class NoCommonLanguagesTest { | ||
|
||
private NoCommonLanguages noCommonLanguages; | ||
|
||
@Before | ||
public void setUp() throws OpenRDFException, IOException { | ||
noCommonLanguages = new NoCommonLanguages(new LanguageCoverage(new InvolvedConcepts())); | ||
} | ||
|
||
@Test | ||
public void oneCommonLang() throws OpenRDFException, IOException { | ||
noCommonLanguages.setRepositoryConnection(new RepositoryBuilder().setUpFromTestResource("commonlanguage_en.rdf").getConnection()); | ||
Assert.assertEquals(1, noCommonLanguages.getResult().getData().size()); | ||
} | ||
|
||
@Test | ||
public void noCommonLang() throws OpenRDFException, IOException { | ||
noCommonLanguages.setRepositoryConnection(new RepositoryBuilder().setUpFromTestResource("nocommonlanguage.rdf").getConnection()); | ||
Assert.assertEquals(0, noCommonLanguages.getResult().getData().size()); | ||
} | ||
|
||
} |