Commit a1608dc7 authored by DanFaria's avatar DanFaria
Browse files

Updated SizeCategory to differentiate entity types

parent f006734e
......@@ -111,7 +111,9 @@ public class AML
private Set<Integer> targetIndividualsToMatch;
private InstanceMatchingCategory inst;
private LanguageSetting lang;
private SizeCategory size;
private SizeCategory classSize;
private SizeCategory propSize;
private SizeCategory indivSize;
private Set<String> languages;
private SelectionType sType;
//Manual matching settings
......@@ -257,18 +259,14 @@ public class AML
matchClasses = false;
matchProperties = false;
}
else if(sourceRatio > 1 && targetRatio > 1)
{
matchClasses = false;
matchProperties = false;
}
sourceIndividualsToMatch = source.getEntities(EntityType.INDIVIDUAL);
targetIndividualsToMatch = target.getEntities(EntityType.INDIVIDUAL);
}
size = SizeCategory.getSizeCategory();
if(size.equals(SizeCategory.HUGE))
threshold = 0.7;
classSize = SizeCategory.getSizeCategory(source.count(EntityType.CLASS), target.count(EntityType.CLASS));
propSize = SizeCategory.getSizeCategory(source.count(EntityType.DATA)+source.count(EntityType.OBJECT), target.count(EntityType.DATA)+target.count(EntityType.OBJECT));
indivSize = SizeCategory.getSizeCategory(source.count(EntityType.INDIVIDUAL), target.count(EntityType.INDIVIDUAL));
lang = LanguageSetting.getLanguageSetting();
languages = new HashSet<String>();
for(String s : source.getLexicon().getLanguages())
......@@ -283,7 +281,7 @@ public class AML
nss = NeighborSimilarityStrategy.DESCENDANTS;
directNeighbors = false;
sType = SelectionType.getSelectionType();
structuralSelection = size.equals(SizeCategory.HUGE);
structuralSelection = classSize.equals(SizeCategory.HUGE);
flagSteps = new Vector<Problem>();
for(Problem f : Problem.values())
flagSteps.add(f);
......@@ -554,11 +552,27 @@ public class AML
}
/**
* @return the SizeCategory of the current ontology pair
* @return the SizeCategory of the classes in the current ontology pair
*/
public SizeCategory getSizeClasses()
{
return classSize;
}
/**
* @return the SizeCategory of the properties in the current ontology pair
*/
public SizeCategory getSizeProperties()
{
return propSize;
}
/**
* @return the SizeCategory of the individuals in the current ontology pair
*/
public SizeCategory getSizeCategory()
public SizeCategory getSizeIndividuals()
{
return size;
return indivSize;
}
/**
......
......@@ -47,7 +47,7 @@ public class StopWordExtender implements LexiconExtender
{
stopList = StopList.read();
AML aml = AML.getInstance();
s = aml.getSizeCategory();
s = aml.getSizeClasses();
Lexicon source = aml.getSource().getLexicon();
extend(source);
Lexicon target = aml.getTarget().getLexicon();
......
......@@ -23,7 +23,6 @@ import aml.AML;
import aml.match.Alignment;
import aml.match.Mapping;
import aml.settings.MappingStatus;
import aml.settings.SizeCategory;
import aml.util.InteractionManager;
public class InteractiveFilterer implements Filterer
......@@ -39,8 +38,6 @@ public class InteractiveFilterer implements Filterer
private final double HIGH_THRESH = 0.7;
private final double AVERAGE_THRESH = 0.2;
private double lowThresh = 0.45;
//Auxiliary variables
private SizeCategory size;
//Constructors
......@@ -48,7 +45,6 @@ public class InteractiveFilterer implements Filterer
{
aml = AML.getInstance();
im = aml.getInteractionManager();
size = aml.getSizeCategory();
a = aml.getAlignment();
qf = aml.buildQualityFlagger();
}
......@@ -70,7 +66,7 @@ public class InteractiveFilterer implements Filterer
int consecutiveNegativeCount = 0;
boolean updated = false;
int consecutiveNegativeLimit;
if(size.equals(SizeCategory.SMALL) && size.equals(SizeCategory.MEDIUM))
if(a.size() < 10000)
consecutiveNegativeLimit = 5;
else
consecutiveNegativeLimit = 10;
......
......@@ -53,7 +53,7 @@ public class QualityFlagger implements Flagger
{
aml = AML.getInstance();
a = aml.getAlignment();
size = aml.getSizeCategory();
size = aml.getSizeClasses();
//Construct the list of auxiliary (re)matchers and alignments
auxMatchers = new Vector<String>();
auxAlignments = new Vector<Alignment>();
......
......@@ -40,7 +40,7 @@ public enum SelectionType
public static SelectionType getSelectionType()
{
SizeCategory size = AML.getInstance().getSizeCategory();
SizeCategory size = AML.getInstance().getSizeClasses();
if(size.equals(SizeCategory.SMALL))
return SelectionType.STRICT;
else if(size.equals(SizeCategory.MEDIUM))
......
......@@ -18,9 +18,6 @@
******************************************************************************/
package aml.settings;
import aml.AML;
import aml.ontology.Ontology;
public enum SizeCategory
{
SMALL,
......@@ -34,15 +31,11 @@ public enum SizeCategory
* Computes the size category of the matching problem
* based on the number of classes of the input ontologies
*/
public static SizeCategory getSizeCategory()
public static SizeCategory getSizeCategory(int sourceEntities, int targetEntities)
{
Ontology source = AML.getInstance().getSource();
Ontology target = AML.getInstance().getTarget();
int sSize = source.count();
int tSize = target.count();
int max = Math.max(sSize, tSize);
int min = Math.min(sSize, tSize);
if(max > 60000 || (min > 30000 && sSize*tSize > 1000000000))
int max = Math.max(sourceEntities, targetEntities);
int min = Math.min(sourceEntities, targetEntities);
if(max > 60000 || min > 40000)
return HUGE;
else if(max > 5000)
return LARGE;
......
......@@ -128,7 +128,7 @@ public class DetailedOptions extends JDialog implements ActionListener, ItemList
string = new JComboBox<String>(measures);
string.setSelectedItem(aml.getStringSimMeasure().toString());
primaryString = new JCheckBox("Global Match");
primaryString.setSelected(aml.getSizeCategory().equals(SizeCategory.SMALL));
primaryString.setSelected(aml.getSizeClasses().equals(SizeCategory.SMALL));
//Structural Matcher
Vector<String> strategies = new Vector<String>(5);
for(NeighborSimilarityStrategy ns : NeighborSimilarityStrategy.values())
......@@ -144,7 +144,7 @@ public class DetailedOptions extends JDialog implements ActionListener, ItemList
select = new JComboBox<String>(types);
select.setSelectedItem(aml.getSelectionType().toString());
structSelection = new JCheckBox("Structure-Based Selection");
structSelection.setSelected(aml.getSizeCategory().equals(SizeCategory.HUGE));
structSelection.setSelected(aml.getSizeClasses().equals(SizeCategory.HUGE));
//Options Panel
optionPanel = new JPanel();
......@@ -268,7 +268,7 @@ public class DetailedOptions extends JDialog implements ActionListener, ItemList
panel.add(p1);
JPanel p2 = new JPanel();
p2.add(primaryString, BorderLayout.CENTER);
if(!aml.getSizeCategory().equals(SizeCategory.SMALL))
if(!aml.getSizeClasses().equals(SizeCategory.SMALL))
{
JLabel warning = new JLabel("Warning: quadratic time-complexity!");
warning.setForeground(Color.RED);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment