Skip to content

Commit

Permalink
Full synonym cross-products for TO eq template
Browse files Browse the repository at this point in the history
* allow non-ASCII (i.e. Japanese) synonyms
* see issue #80
  • Loading branch information
Heiko Dietze committed Nov 24, 2015
1 parent ade8886 commit dd904f0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ protected IOCModule getCommitModule() {

@Override
protected IOCModule getRulesModule() {
return new XMLDynamicRulesModule("termgenie_rules_to.xml", false, true, true, applicationProperties);
boolean filterNonAsciiSynonyms = false; // allow japanese synonyms
return new XMLDynamicRulesModule("termgenie_rules_to.xml", false, true, filterNonAsciiSynonyms, applicationProperties);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ function eq_simple() {
var definition = "A trait which is associated with the "
+ termname(q, TO) + " of " + refname(e, TO) + ".";

var synonyms = null;
// String label, List<ISynonym> results, String prefix, String infix, String suffix, String scope
synonyms = termgenie.addSynonym(label, synonyms, null, label, ' trait', 'EXACT');
var synonyms = termgenie.synonyms(null, e, TO, " ", q, TO, "", null, label);

var mdef = createMDef("?Q and 'inheres in' some ?E");
mdef.addParameter('E', e, TO);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package org.bbop.termgenie.rules;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
import static org.junit.Assert.*;

import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

Expand All @@ -29,6 +27,8 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.obolibrary.macro.ManchesterSyntaxTool;
import org.obolibrary.oboformat.model.Clause;
import org.obolibrary.oboformat.model.Frame;
import org.obolibrary.oboformat.parser.OBOFormatConstants.OboFormatTag;
import org.semanticweb.owlapi.model.OWLClassExpression;

Expand All @@ -55,8 +55,9 @@ private static IOCModule getOntologyModule() throws IOException {

@BeforeClass
public static void beforeClass() throws IOException {
boolean filterNonAsciiSynonyms = false; // allow japanese synonyms
IOCModule ontologyModule = getOntologyModule();
Injector injector = TermGenieGuice.createInjector(new XMLDynamicRulesModule("termgenie_rules_to.xml", false, true, true, null),
Injector injector = TermGenieGuice.createInjector(new XMLDynamicRulesModule("termgenie_rules_to.xml", false, true, filterNonAsciiSynonyms, null),
ontologyModule,
new ReasonerModule(null));

Expand Down Expand Up @@ -111,7 +112,14 @@ public void test_eq_simple_1() {
assertEquals(1, list.size());
TermGenerationOutput output = list.get(0);
assertNull(output.getError(), output.getError());
assertEquals("root cap permeability", output.getTerm().getTagValue(OboFormatTag.TAG_NAME));
Frame term = output.getTerm();
assertEquals("root cap permeability", term.getTagValue(OboFormatTag.TAG_NAME));
Collection<Clause> synonymClauses = term.getClauses(OboFormatTag.TAG_SYNONYM);
System.out.println(synonymClauses.size());
for (Clause clause : synonymClauses) {
System.out.println(clause);
}
assertFalse(synonymClauses.isEmpty());
}

private List<TermGenerationInput> createEQSimpleTask(String entity, String quality) {
Expand Down

0 comments on commit dd904f0

Please sign in to comment.