Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ public void processIncremental(DiTreeEntity definition, int conceptNid, Tracking
public void buildNecessaryNormalForm(TrackingCallable<?> progressUpdater) {
//TODO: refactor to use primitive collections directly.
nnfb = NecessaryNormalFormBuilder.create(sso.getOntology(),
convertToLongMap(sso.getSuperConcepts()),
convertToLongMap(sso.getSuperRoleTypes(false)),
sso.getSuperConcepts(),
sso.getSuperRoleTypes(false),
TinkarTerm.ROOT_VERTEX.nid(),
(workDone, max) -> progressUpdater.updateProgress(workDone, max));
nnfb.generate();
Expand All @@ -124,26 +124,21 @@ private MutableLongObjectMap<MutableLongSet> convertToLongMap(HashMap<Long, Set<

@Override
public ImmutableIntSet getEquivalent(int id) {
Set<Long> eqs = sso.getEquivalentConcepts(id);
MutableIntSet eqsInt = IntSets.mutable.empty();
eqs.stream().mapToInt(Long::intValue).forEach(eqsInt::add);
return eqsInt.toImmutable();
MutableLongSet eqs = sso.getEquivalentConcepts(id);
return toIntSet(eqs);
}

@Override
public ImmutableIntSet getParents(int id) {
Set<Long> supers = sso.getSuperConcepts(id);
MutableIntSet eqsInt = IntSets.mutable.empty();
supers.stream().mapToInt(Long::intValue).forEach(eqsInt::add);
return eqsInt.toImmutable();
MutableLongSet supers = sso.getSuperConcepts(id);
return toIntSet(supers);
}

@Override
public ImmutableIntSet getChildren(int id) {
Set<Long> subs = sso.getSubConcepts(id);
MutableIntSet eqsInt = IntSets.mutable.empty();
subs.stream().mapToInt(Long::intValue).forEach(eqsInt::add);
return eqsInt.toImmutable();
MutableLongSet subs = sso.getSubConcepts(id);
return toIntSet(subs);

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import org.eclipse.collections.api.list.primitive.MutableLongList;
import org.eclipse.collections.api.set.primitive.ImmutableLongSet;
import org.eclipse.collections.api.set.primitive.MutableLongSet;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -50,8 +51,8 @@ public abstract class HybridClassifierWithoutAbsentTestBase extends HybridReason

private HashMap<Integer, Long> nid_sctid_map;

private Set<Long> toSctids(Set<Long> nids) {
return nids.stream().map(x -> nid_sctid_map.get(x.intValue())).collect(Collectors.toSet());
private Set<Long> toSctids(MutableLongSet mutableLongSet) {
return mutableLongSet.collect(x -> nid_sctid_map.get((int) x));
}

/**
Expand Down Expand Up @@ -103,7 +104,7 @@ public void isas() throws Exception {
assertTrue(parents.isEmpty());
// has a parent in the db
assertEquals(1, sups.size());
assertEquals(TinkarTerm.PHENOMENON.nid(), sso.getSuperConcepts(nid).iterator().next());
assertEquals(TinkarTerm.PHENOMENON.nid(), sso.getSuperConcepts(nid).longIterator().next());
continue;
} else {
assertNotNull(parents);
Expand Down Expand Up @@ -135,8 +136,7 @@ public void isas() throws Exception {
LOG.error("Sno: " + par);
LOG.error("Elk: " + sup);
if (sups.contains(null)) {
sso.getSuperConcepts(nid)
.forEach(sup_nid -> LOG.error(" : " + PrimitiveData.text((sup_nid.intValue()))));
sso.getSuperConcepts(nid).forEach(sup_nid -> LOG.error(" : " + PrimitiveData.text((int) sup_nid)));
}
}
LOG.error("Miss cnt: " + miss_cnt);
Expand Down
Loading