Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue #896 #961

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
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 @@ -61,7 +61,6 @@ protected boolean isMetricInvalidated(@Nonnull List<? extends OWLOntologyChange>
*/
@Override
protected void disposeMetric() {

}

/**
Expand All @@ -72,6 +71,6 @@ protected void disposeMetric() {
@Nonnull
@Override
public String getName() {
return "Expressivity";
return "DL Expressivity";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<? extends OWLAxiom> axioms = lastMetric.getAxioms();
final OWLAxiomTypeFramePanel panel = new OWLAxiomTypeFramePanel(owlEditorKit);
Set<OWLAxiom> 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<? extends OWLAxiom> axioms = lastMetric.getAxioms();
final OWLAxiomTypeFramePanel panel = new OWLAxiomTypeFramePanel(owlEditorKit);
Expand All @@ -99,8 +108,7 @@ public void windowClosing(WindowEvent e) {
dlg.setModal(false);
dlg.setVisible(true);
}



protected void initialiseOWLView() {
createBasicMetrics();
createClassAxiomMetrics();
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}


Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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));
// }
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.protege.editor.owl.ui.prefix;

import org.hamcrest.Matchers;

import org.junit.Before;
import org.junit.Test;

Expand Down
Loading