Search in sources :

Example 1 with OWLOntologyID

use of org.semanticweb.owlapi.model.OWLOntologyID in project protege-client by protegeproject.

the class ShowUncommittedChangesAction method displayUncommittedChanges.

private void displayUncommittedChanges(OWLOntology ontology, List<OWLOntologyChange> uncommitted) {
    String shortOntologyName = "";
    OWLOntologyID ontologyId = ontology.getOntologyID();
    if (!ontologyId.isAnonymous()) {
        shortOntologyName = ontology.getOntologyID().getOntologyIRI().get().getRemainder().get();
    }
    if (shortOntologyName.isEmpty()) {
        shortOntologyName = ontologyId.toString();
    }
    ChangeListTableModel tableModel = new ChangeListTableModel(uncommitted);
    JTable table = new JTable(tableModel);
    table.setDefaultRenderer(OWLObject.class, new OWLCellRenderer(getOWLEditorKit()));
    JScrollPane pane = new JScrollPane(table);
    JDialog dialog = new JDialog((Frame) SwingUtilities.getAncestorOfClass(Frame.class, getOWLWorkspace()));
    dialog.setTitle("Uncommitted changes for " + shortOntologyName);
    dialog.getContentPane().add(pane);
    dialog.setResizable(true);
    dialog.setModal(true);
    dialog.pack();
    dialog.setVisible(true);
}
Also used : OWLCellRenderer(org.protege.editor.owl.ui.renderer.OWLCellRenderer) OWLOntologyID(org.semanticweb.owlapi.model.OWLOntologyID) ChangeListTableModel(org.protege.editor.owl.client.panel.ChangeListTableModel)

Example 2 with OWLOntologyID

use of org.semanticweb.owlapi.model.OWLOntologyID in project webprotege by protegeproject.

the class ModifiedProjectOntologiesCalculator_TestCase method shouldIgnoreAnonymousOntologies.

@Test
public void shouldIgnoreAnonymousOntologies() {
    when(projectOntology.getOntologyID()).thenReturn(new OWLOntologyID());
    when(externalOntology.getOntologyID()).thenReturn(new OWLOntologyID());
    assertThat(calculator.getModifiedOntologyDiffs(), is(empty()));
}
Also used : OWLOntologyID(org.semanticweb.owlapi.model.OWLOntologyID) Test(org.junit.Test)

Example 3 with OWLOntologyID

use of org.semanticweb.owlapi.model.OWLOntologyID in project webprotege by protegeproject.

the class ModifiedProjectOntologiesCalculator_TestCase method shouldNotPerformDiffForDifferentOntologyIRIs.

@Test
public void shouldNotPerformDiffForDifferentOntologyIRIs() {
    OWLOntologyID projectOntologyId = new OWLOntologyID(Optional.of(IRI.create("http://ontology.iri.a")), Optional.absent());
    when(projectOntology.getOntologyID()).thenReturn(projectOntologyId);
    OWLOntologyID externalOntologyId = new OWLOntologyID(Optional.of(IRI.create("http://ontology.iri.b")), Optional.absent());
    when(externalOntology.getOntologyID()).thenReturn(externalOntologyId);
    assertThat(calculator.getModifiedOntologyDiffs(), is(empty()));
}
Also used : OWLOntologyID(org.semanticweb.owlapi.model.OWLOntologyID) Test(org.junit.Test)

Example 4 with OWLOntologyID

use of org.semanticweb.owlapi.model.OWLOntologyID in project webprotege by protegeproject.

the class WebProtegeOntologyIRIShortFormProvider_TestCase method setUp.

@Before
public void setUp() throws Exception {
    iri = IRI.create("http://stuff");
    ontologyId = new OWLOntologyID(iri);
    when(rootOntology.getOntologyID()).thenReturn(ontologyId);
}
Also used : OWLOntologyID(org.semanticweb.owlapi.model.OWLOntologyID) Before(org.junit.Before)

Example 5 with OWLOntologyID

use of org.semanticweb.owlapi.model.OWLOntologyID in project webprotege by protegeproject.

the class OntologyIdData_CustomFieldSerializer method instantiate.

public static OntologyIdData instantiate(SerializationStreamReader streamReader) throws SerializationException {
    boolean anonymous = streamReader.readBoolean();
    OWLOntologyID ontologyID;
    if (!anonymous) {
        IRI ontologyIRI = IRI.create(streamReader.readString());
        String versionIRIString = streamReader.readString();
        IRI versionIRI;
        if (versionIRIString.isEmpty()) {
            versionIRI = null;
        } else {
            versionIRI = IRI.create(versionIRIString);
        }
        ontologyID = new OWLOntologyID(ontologyIRI, versionIRI);
    } else {
        ontologyID = new OWLOntologyID();
    }
    String browserText = streamReader.readString();
    return new OntologyIdData(ontologyID, browserText);
}
Also used : IRI(org.semanticweb.owlapi.model.IRI) OWLOntologyID(org.semanticweb.owlapi.model.OWLOntologyID)

Aggregations

OWLOntologyID (org.semanticweb.owlapi.model.OWLOntologyID)101 Test (org.junit.Test)32 OWLOntology (org.semanticweb.owlapi.model.OWLOntology)32 OWLOntologyCreationException (org.semanticweb.owlapi.model.OWLOntologyCreationException)23 HashSet (java.util.HashSet)22 OWLOntologyManager (org.semanticweb.owlapi.model.OWLOntologyManager)21 InputStream (java.io.InputStream)20 BlankNodeOrIRI (org.apache.clerezza.commons.rdf.BlankNodeOrIRI)19 Triple (org.apache.clerezza.commons.rdf.Triple)19 IRI (org.semanticweb.owlapi.model.IRI)18 IRI (org.apache.clerezza.commons.rdf.IRI)17 ResponseBuilder (javax.ws.rs.core.Response.ResponseBuilder)16 RDFTerm (org.apache.clerezza.commons.rdf.RDFTerm)13 IOException (java.io.IOException)12 UnmodifiableOntologyCollectorException (org.apache.stanbol.ontologymanager.servicesapi.collector.UnmodifiableOntologyCollectorException)12 WebApplicationException (javax.ws.rs.WebApplicationException)11 Graph (org.apache.clerezza.commons.rdf.Graph)10 AddImport (org.semanticweb.owlapi.model.AddImport)10 Path (javax.ws.rs.Path)9 OntologySpace (org.apache.stanbol.ontologymanager.servicesapi.scope.OntologySpace)8