diff --git a/protege-editor-owl/src/main/java/org/protege/editor/owl/ui/metrics/DLExpressivityMetric.java b/protege-editor-owl/src/main/java/org/protege/editor/owl/ui/metrics/DLExpressivityMetric.java index 4112387a4..950f22c8a 100644 --- a/protege-editor-owl/src/main/java/org/protege/editor/owl/ui/metrics/DLExpressivityMetric.java +++ b/protege-editor-owl/src/main/java/org/protege/editor/owl/ui/metrics/DLExpressivityMetric.java @@ -61,7 +61,6 @@ protected boolean isMetricInvalidated(@Nonnull List */ @Override protected void disposeMetric() { - } /** @@ -72,6 +71,6 @@ protected void disposeMetric() { @Nonnull @Override public String getName() { - return "Expressivity"; + return "DL Expressivity"; } } diff --git a/protege-editor-owl/src/main/java/org/protege/editor/owl/ui/metrics/MetricsPanel.java b/protege-editor-owl/src/main/java/org/protege/editor/owl/ui/metrics/MetricsPanel.java index 170078807..9c649c4c8 100644 --- a/protege-editor-owl/src/main/java/org/protege/editor/owl/ui/metrics/MetricsPanel.java +++ b/protege-editor-owl/src/main/java/org/protege/editor/owl/ui/metrics/MetricsPanel.java @@ -75,11 +75,20 @@ private void invalidateMetrics() { private void createPopupMenu() { JMenuItem showAxioms = new JMenuItem("Show axioms"); + JMenuItem showDL = new JMenuItem("DL Expressivity"); popupMenu.add(showAxioms); + popupMenu.add(showDL); + showDL.addActionListener(e -> showDLExpressivityDialog()); showAxioms.addActionListener(e -> showAxiomTypeDialog()); } - - + private void showDLExpressivityDialog() { + Set axioms = lastMetric.getAxioms(); + final OWLAxiomTypeFramePanel panel = new OWLAxiomTypeFramePanel(owlEditorKit); + Set axs = new HashSet<>(axioms); + panel.setRoot(axs); + panel.setPreferredSize(new Dimension(800, 300)); + JOptionPane.showMessageDialog(panel, new DLExpressivityMetric(getOntology()).getValue(),"DL Expressivity",JOptionPane.OK_OPTION); + } private void showAxiomTypeDialog() { Set axioms = lastMetric.getAxioms(); final OWLAxiomTypeFramePanel panel = new OWLAxiomTypeFramePanel(owlEditorKit); @@ -99,8 +108,7 @@ public void windowClosing(WindowEvent e) { dlg.setModal(false); dlg.setVisible(true); } - - + protected void initialiseOWLView() { createBasicMetrics(); createClassAxiomMetrics(); @@ -134,7 +142,8 @@ private void createUI() { + fontMetrics.getMaxDescent() + 4); table.setShowGrid(true); - table.getColumnModel().getColumn(1).setMaxWidth(150); + table.getColumnModel().getColumn(1).setMinWidth(200); + table.getColumnModel().getColumn(1).setMinWidth(300); table.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { @@ -277,12 +286,13 @@ private void createBasicMetrics() { metrics.add(new ReferencedIndividualCount(getOntology())); metrics.add(new ReferencedAnnotationPropertyCount(getOntology())); // Temporarily removed due to a problem with upgrading the OWL API -// metrics.add(new DLExpressivityMetric(getOntology())); + //metrics.add(new DLExpressivity(getOntology())); + //metrics.add(new DLExpressivityMetric(getOntology())); /* * Degenericized to be compatible with changing OWLAPI interfaces */ OWLMetricManager metricManager = new OWLMetricManager((List) metrics); - metricManagerMap.put("Metrics", metricManager); + metricManagerMap.put("Basic Metrics", metricManager); } diff --git a/protege-editor-owl/src/test/java/org/protege/editor/owl/model/library/Folder_IT.java b/protege-editor-owl/src/test/java/org/protege/editor/owl/model/library/Folder_IT.java index c4ebc2874..9ba13b45b 100644 --- a/protege-editor-owl/src/test/java/org/protege/editor/owl/model/library/Folder_IT.java +++ b/protege-editor-owl/src/test/java/org/protege/editor/owl/model/library/Folder_IT.java @@ -1,6 +1,7 @@ package org.protege.editor.owl.model.library; import junit.framework.TestCase; + import org.protege.editor.owl.model.library.folder.FolderGroupManager; import org.protege.xmlcatalog.CatalogUtilities; import org.protege.xmlcatalog.XMLCatalog; diff --git a/protege-editor-owl/src/test/java/org/protege/editor/owl/model/parser/OWLLiteralParser_TestCase.java b/protege-editor-owl/src/test/java/org/protege/editor/owl/model/parser/OWLLiteralParser_TestCase.java index ff006b1fb..631e49b8c 100644 --- a/protege-editor-owl/src/test/java/org/protege/editor/owl/model/parser/OWLLiteralParser_TestCase.java +++ b/protege-editor-owl/src/test/java/org/protege/editor/owl/model/parser/OWLLiteralParser_TestCase.java @@ -1,6 +1,7 @@ package org.protege.editor.owl.model.parser; import org.junit.Before; + import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.runners.MockitoJUnitRunner; diff --git a/protege-editor-owl/src/test/java/org/protege/editor/owl/ui/metrics/DLExpressivity_TestCase.java b/protege-editor-owl/src/test/java/org/protege/editor/owl/ui/metrics/DLExpressivity_TestCase.java new file mode 100644 index 000000000..7246fadb3 --- /dev/null +++ b/protege-editor-owl/src/test/java/org/protege/editor/owl/ui/metrics/DLExpressivity_TestCase.java @@ -0,0 +1,66 @@ +package org.protege.editor.owl.ui.metrics; + +import org.junit.Before; + +import org.junit.Test; +import org.semanticweb.owlapi.apibinding.OWLManager; +import org.semanticweb.owlapi.model.OWLOntology; +import org.semanticweb.owlapi.model.OWLOntologyCreationException; +import org.semanticweb.owlapi.model.OWLOntologyManager; + + +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + +import java.io.File; + +public class DLExpressivity_TestCase { + + private OWLOntology owlModel1; + private OWLOntology owlModel2; + public static final OWLOntologyManager owlmanage1 = OWLManager.createOWLOntologyManager(); + public static final OWLOntologyManager owlmanage2 = OWLManager.createOWLOntologyManager(); + public static final File SOURCE_DIR=new File("src/test/resources/ontologies"); + public static final String PIZZA_File = "pizza.owl"; + public static final String SPORT_File = "sports.owl"; +// public static final String NETFLIX_File = "Netflix.owl"; +// public static final String PHOTO_File = "photography.owl"; + public static final String A1 = "SHIQ"; + public static final String A2 = "SHOIND"; + + @Before + public void setUp() throws OWLOntologyCreationException { + owlModel1 = owlmanage1.loadOntologyFromOntologyDocument(new File(SOURCE_DIR,SPORT_File)); + owlModel2 = owlmanage2.loadOntologyFromOntologyDocument(new File(SOURCE_DIR,PIZZA_File)); + } + + @Test + public void shouldPassTest1() { + String dl1 = new DLExpressivityMetric(owlModel1).getValue(); + assertThat(dl1, is(A1)); + } + +// @Test +// public void shouldPassTest2() { +// String dl1 = new DLExpressivityMetric(owlModel2).getValue(); +// assertThat(dl1, is(A2)); +// } +// +// @Test +// public void shouldPassTest3() { +// String dl1 = new DLExpressivityMetric(owlModel3).getValue(); +// assertThat(dl1, is(A3)); +// } +// +// @Test +// public void shouldPassTest4() { +// String dl1 = new DLExpressivityMetric(owlModel4).getValue(); +// assertThat(dl1, is(A4)); +// } +// +// @Test +// public void shouldPassTest5() { +// String dl1 = new DLExpressivityMetric(owlModel5).getValue(); +// assertThat(dl1, is(A5)); +// } +} \ No newline at end of file diff --git a/protege-editor-owl/src/test/java/org/protege/editor/owl/ui/prefix/PrefixMapping_TestCase.java b/protege-editor-owl/src/test/java/org/protege/editor/owl/ui/prefix/PrefixMapping_TestCase.java index 5c18fa0a4..963067817 100644 --- a/protege-editor-owl/src/test/java/org/protege/editor/owl/ui/prefix/PrefixMapping_TestCase.java +++ b/protege-editor-owl/src/test/java/org/protege/editor/owl/ui/prefix/PrefixMapping_TestCase.java @@ -1,6 +1,7 @@ package org.protege.editor.owl.ui.prefix; import org.hamcrest.Matchers; + import org.junit.Before; import org.junit.Test; diff --git a/protege-editor-owl/src/test/resources/ontologies/sports.owl b/protege-editor-owl/src/test/resources/ontologies/sports.owl new file mode 100644 index 000000000..f412a1cfc --- /dev/null +++ b/protege-editor-owl/src/test/resources/ontologies/sports.owl @@ -0,0 +1,1116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #BasketballTeam + BasketballTeam + + + + #ChampionshipTour + ChampionshipTour + + + + #DebutTeam + DebutTeam + + + + #Domain_entity + Domain_entity + + + + #FootballTeam + FootballTeam + + + + #Footballer + Footballer + + + + #Independent_entity + Independent_entity + + + + #InterestingTournament + InterestingTournament + + + + #Master + Master + + + + #MultiSportTeam + MultisportTeam + + + + #OWLObjectProperty_17222bbb_c3f7_44e0_b596_36b8c267f22b + modifier_property + + + + #OWLObjectProperty_33a3b8c5_35f3_40d4_93d0_5093e3339c86 + relational_property + + + + #Person + Person + + + + #PopularSport + PopularSport + + + + #RugbyTeam + RugbyTeam + + + + #SmallSportEvent + SmallSportEvent + + + + #SportGame + SportGame + + + + #Sportsman + Sportsman + + + + #StrongAthlete + StrongAthlete + + + + #Team + Team + + + + #TeamMember + TeamMember + + + + #TeamSport + TeamSport + + + + #Tournament + Tournament + + + + #Trainer + Trainer + + + + #VolleyballTeam + VolleyballTeam + + + + #belongsTo + belongsTo + + + + #consistsOf + consistsOf + + + + #hasWinner + hasWinner + + + + #includes + includes + + + + #isPlayedAt + isPlayedAt + + + + #isPlayedBy + isPlayedBy + + + + #isWinnerOf + isWinnerOf + + + + #organizedBy + organizedBy + + + + #organizes + organizes + + + + #participatesIn + participatesIn + + + + #plays + plays + + + + #playsFor + playsFor + + + + #responsibleFor + responsibleFor + + + + #takesPartIn + takesPartIn + + + + + + +