All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.protege.editor.owl.OWLEditorKitFactory Maven / Gradle / Ivy

Go to download

OWL ontology editing infrastructure used by the Protege desktop application.

The newest version!
package org.protege.editor.owl;

import org.protege.editor.core.editorkit.EditorKit;
import org.protege.editor.core.editorkit.EditorKitDescriptor;
import org.protege.editor.core.editorkit.EditorKitFactory;
import org.protege.editor.core.ui.util.UIUtil;

import javax.annotation.Nonnull;
import java.io.File;
import java.net.URI;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;


/**
 * Author: Matthew Horridge
* The University Of Manchester
* Medical Informatics Group
* Date: Mar 17, 2006

* [email protected]
* www.cs.man.ac.uk/~horridgm

*/ public class OWLEditorKitFactory implements EditorKitFactory { public static final String ID = "org.protege.editor.owl.OWLEditorKitFactory"; public static final List OWL_EXTENSIONS = Collections.unmodifiableList(Arrays.asList(".owl", ".rdf", ".xml")); /** * Gets the identifier for this EditorKitFactory. * @return A String representation of the * clsdescriptioneditor kit factory. */ @Nonnull public String getId() { return ID; } @Nonnull public EditorKit createEditorKit() { return new OWLEditorKit(this); } public boolean canLoad(@Nonnull URI uri) { String s = uri.toString(); for (String ext : OWL_EXTENSIONS) { if (s.endsWith(ext)) { return true; } } return false; } public boolean isValidDescriptor(@Nonnull EditorKitDescriptor descriptor) { URI uri = descriptor.getURI(OWLEditorKit.URI_KEY); if(uri == null || uri.getScheme() == null) { return false; } if (UIUtil.isLocalFile(uri)) { File file = new File(uri); return file.exists(); } return true; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy