protected void endDocument() { writer.flush(); writer.println(); writeComment(VersionInfo.getVersionInfo().getGeneratedByMessage()); writer.flush(); }
public boolean isParseable(String ontFile) { boolean isParseable = false; File f = new File(ontFile); if(!f.exists()) System.err.println("\tThe given ontology filepath '" + ontFile + "' does not point to a valid file"); else { OWLOntologyManager man = OWLManager.createOWLOntologyManager(); try{ ont = man.loadOntologyFromOntologyDocument(f); } catch(OWLOntologyCreationException e) { System.err.println("\tError parsing ontology file '" + ontFile + "' using the OWL API v" + VersionInfo.getVersionInfo().getVersion() + ":"); e.printStackTrace(); } if(ont != null) isParseable = true; } return isParseable; }
private void writeHeader(OWLOntology ontology, Writer writer) throws OWLRendererException { OBOTagValuePairList tvpList = new OBOTagValuePairList(OBOVocabulary.getHeaderTags()); tvpList.setDefault(OBOVocabulary.DEFAULT_NAMESPACE, defaultPrefix); for (OWLAnnotation ax : ontology.getAnnotations()) { if (ax.getProperty().isComment()) { tvpList.addPair(OBOVocabulary.REMARK, ((OWLLiteral) ax.getValue()).getLiteral()); } else { tvpList.visit(ax); } } for (OWLImportsDeclaration importDecl : ontology.getImportsDeclarations()) { tvpList.addPair(OBOVocabulary.IMPORT, importDecl.getIRI().toString()); } Map<String, String> namespace2PrefixMap = loadUsedNamespaces(ontology); for (String namespace : namespace2PrefixMap.keySet()) { String mapping = namespace2PrefixMap.get(namespace) + " " + namespace; tvpList.addPair(OBOVocabulary.ID_SPACE, mapping); } // overwrite the existing values for below tvpList.setPair(OBOVocabulary.FORMAT_VERSION, "1.2"); tvpList.setPair(OBOVocabulary.DATE, getTimestampFormatter().format(new Date(System.currentTimeMillis()))); tvpList.setPair(OBOVocabulary.SAVED_BY, System.getProperty("user.name")); tvpList.setPair(OBOVocabulary.AUTO_GENERATED_BY, VersionInfo.getVersionInfo().toString()); tvpList.write(writer); }
private void writeHeader(OWLOntology ontology, Writer writer) throws OWLRendererException { OBOTagValuePairList tvpList = new OBOTagValuePairList(OBOVocabulary.getHeaderTags()); tvpList.setDefault(OBOVocabulary.DEFAULT_NAMESPACE, defaultPrefix); for (OWLAnnotation ax : ontology.getAnnotations()) { if (ax.getProperty().isComment()) { tvpList.addPair(OBOVocabulary.REMARK, ((OWLLiteral) ax.getValue()).getLiteral()); } else { tvpList.visit(ax); } } for (OWLImportsDeclaration importDecl : ontology.getImportsDeclarations()) { tvpList.addPair(OBOVocabulary.IMPORT, importDecl.getIRI().toString()); } Map<String, String> namespace2PrefixMap = loadUsedNamespaces(ontology); for (String namespace : namespace2PrefixMap.keySet()) { String mapping = namespace2PrefixMap.get(namespace) + " " + namespace; tvpList.addPair(OBOVocabulary.ID_SPACE, mapping); } // overwrite the existing values for below tvpList.setPair(OBOVocabulary.FORMAT_VERSION, "1.2"); tvpList.setPair(OBOVocabulary.DATE, getTimestampFormatter().format(new Date(System.currentTimeMillis()))); tvpList.setPair(OBOVocabulary.SAVED_BY, System.getProperty("user.name")); tvpList.setPair(OBOVocabulary.AUTO_GENERATED_BY, VersionInfo.getVersionInfo().toString()); tvpList.write(writer); }
@Override protected void endDocument() { writer.flush(); writer.println(); writeComment(VersionInfo.getVersionInfo().getGeneratedByMessage()); writer.flush(); }
protected void initialise(){ logger.info("Using OWL API version " + VersionInfo.getVersionInfo().getVersion()); this.newPhysicalURIs = new HashSet<URI>(); modelManager = new OWLModelManagerImpl(); modelManager.setExplanationManager(new ExplanationManager(this)); modelManager.setMissingImportHandler(new MissingImportHandlerUI(this)); modelManager.setSaveErrorHandler(new SaveErrorHandler(){ public void handleErrorSavingOntology(OWLOntology ont, URI physicalURIForOntology, OWLOntologyStorageException e) throws Exception { handleSaveError(ont, physicalURIForOntology, e); } }); loadErrorHandler = new OntologyLoadErrorHandlerUI(this); modelManager.setLoadErrorHandler(loadErrorHandler); loadIOListenerPlugins(); registration = ProtegeOWL.getBundleContext().registerService(EditorKit.class.getCanonicalName(), this, new Properties()); }
private void writeHeader(OWLOntology ontology, Writer writer) { OBOTagValuePairList tvpList = new OBOTagValuePairList(OBOVocabulary.getHeaderTags()); tvpList.setDefault(OBOVocabulary.DEFAULT_NAMESPACE, defaultPrefix); for (OWLAnnotation ax : ontology.getAnnotations()) { if (ax.getProperty().isComment()) { tvpList.addPair(OBOVocabulary.REMARK, ((OWLLiteral) ax.getValue()).getLiteral()); } else { tvpList.visit(ax); } } for (OWLImportsDeclaration importDecl : ontology.getImportsDeclarations()) { tvpList.addPair(OBOVocabulary.IMPORT, importDecl.getIRI().toString()); } Map<String, String> namespace2PrefixMap = loadUsedNamespaces(ontology); for (String namespace : namespace2PrefixMap.keySet()) { String mapping = namespace2PrefixMap.get(namespace) + " " + namespace; tvpList.addPair(OBOVocabulary.ID_SPACE, mapping); } // overwrite the existing values for below tvpList.setPair(OBOVocabulary.FORMAT_VERSION, "1.2"); tvpList.setPair(OBOVocabulary.DATE, getTimestampFormatter().format(new Date(System.currentTimeMillis()))); tvpList.setPair(OBOVocabulary.SAVED_BY, System.getProperty("user.name")); tvpList.setPair(OBOVocabulary.AUTO_GENERATED_BY, VersionInfo.getVersionInfo().toString()); tvpList.write(writer); }
/** * End document. */ public void endDocument() { writer.endDocument(); writer.writeComment(VersionInfo.getVersionInfo().getGeneratedByMessage()); }
public OWLEditorKit(@Nonnull OWLEditorKitFactory editorKitFactory) { super(editorKitFactory); logger.info("OWL API Version: {}", VersionInfo.getVersionInfo().getVersion()); modelManager = new OWLModelManagerImpl(); // Make sure that the workspace is not null, // but don't initialise it until our EditorKitHooks have been initialised. workspace = new OWLWorkspace(); workspace.setup(this); Initializers.loadEditorKitHooks(this); searchManagerSelector = new SearchManagerSelector(this); modelManager.addOntologyChangeListener(ontologyChangeListener); modelManager.setExplanationManager(new ExplanationManager(this)); modelManager.setMissingImportHandler(new MissingImportHandlerUI(this)); loadErrorHandler = new OntologyLoadErrorHandlerUI(this); modelManager.setLoadErrorHandler(loadErrorHandler); loadIOListenerPlugins(); registration = ProtegeOWL.getBundleContext().registerService(EditorKit.class.getCanonicalName(), this, new Hashtable<>()); // Finally load the UI workspace.initialise(); }
/** * End document. */ public void endDocument() { writer.endDocument(); writer.writeComment(VersionInfo.getVersionInfo().getGeneratedByMessage()); }
public OWLEditorKit(@Nonnull OWLEditorKitFactory editorKitFactory) { super(editorKitFactory); logger.info("OWL API Version: {}", VersionInfo.getVersionInfo().getVersion()); modelManager = new OWLModelManagerImpl(); // Make sure that the workspace is not null, // but don't initialise it until our EditorKitHooks have been initialised. workspace = new OWLWorkspace(); workspace.setup(this); Initializers.loadEditorKitHooks(this); searchManagerSelector = new SearchManagerSelector(this); modelManager.addOntologyChangeListener(ontologyChangeListener); modelManager.setExplanationManager(new ExplanationManager(this)); modelManager.setMissingImportHandler(new MissingImportHandlerUI(this)); loadErrorHandler = new OntologyLoadErrorHandlerUI(this); modelManager.setLoadErrorHandler(loadErrorHandler); loadIOListenerPlugins(); registration = ProtegeOWL.getBundleContext().registerService(EditorKit.class.getCanonicalName(), this, new Hashtable<>()); // Finally load the UI workspace.initialise(); }
/** * End document. */ public void endDocument() { writer.endDocument(); writer.writeComment(VersionInfo.getVersionInfo().getGeneratedByMessage()); }
protected void initialise() { logger.info("Using OWL API version " + VersionInfo.getVersionInfo().getVersion()); this.newPhysicalURIs = new HashSet<URI>(); modelManager = new OWLModelManagerImpl(); modelManager.setExplanationManager(new ExplanationManager(this)); modelManager.setMissingImportHandler(new MissingImportHandlerUI(this)); modelManager.setSaveErrorHandler(new SaveErrorHandler() { public void handleErrorSavingOntology(OWLOntology ont, URI physicalURIForOntology, OWLOntologyStorageException e) throws Exception { handleSaveError(ont, physicalURIForOntology, e); } }); ontologyChangeListener = new OWLOntologyChangeListener() { public void ontologiesChanged(List<? extends OWLOntologyChange> owlOntologyChanges) throws OWLException { modifiedDocument = true; } }; modelManager.addOntologyChangeListener(ontologyChangeListener); searchManager = new SearchManager(this, new SearchMetadataImportManager()); loadErrorHandler = new OntologyLoadErrorHandlerUI(this); modelManager.setLoadErrorHandler(loadErrorHandler); loadIOListenerPlugins(); registration = ProtegeOWL.getBundleContext().registerService(EditorKit.class.getCanonicalName(), this, new Hashtable<String, Object>()); getWorkspace().refreshComponents(); }
protected void endDocument() throws IOException { writer.endDocument(); writer.writeComment(VersionInfo.getVersionInfo().getGeneratedByMessage()); }
/** * End document. */ public void endDocument() { writer.endDocument(); writer.writeComment(VersionInfo.getVersionInfo().getGeneratedByMessage()); }
@Override protected void endDocument() { writeComment(VersionInfo.getVersionInfo().getGeneratedByMessage()); if (!format.isAddMissingTypes()) { // missing type declarations could have been omitted, adding a // comment to document it writeComment("Warning: type declarations were not added automatically."); } writer.flush(); pending.clear(); }
@Override protected void endDocument() { writeComment(VersionInfo.getVersionInfo().getGeneratedByMessage()); if (!format.isAddMissingTypes()) { // missing type declarations could have been omitted, adding a // comment to document it writeComment("Warning: type declarations were not added automatically."); } writer.flush(); pending.clear(); }
@Override protected void endDocument() { writeComment(VersionInfo.getVersionInfo().getGeneratedByMessage()); if (!format.isAddMissingTypes()) { // missing type declarations could have been omitted, adding a // comment to document it writeComment("Warning: type declarations were not added automatically."); } writer.flush(); pending.clear(); }
@Override protected void endDocument() { writeComment(VersionInfo.getVersionInfo().getGeneratedByMessage()); if (!format.isAddMissingTypes()) { // missing type declarations could have been omitted, adding a // comment to document it writeComment("Warning: type declarations were not added automatically."); } writer.flush(); pending.clear(); }
@Override protected void endDocument() { writer.flush(); writer.println(); writeComment(VersionInfo.getVersionInfo().getGeneratedByMessage()); if (format instanceof RDFOntologyFormat && !((RDFOntologyFormat) format).isAddMissingTypes()) { // missing type declarations could have been omitted, adding a // comment to document it writeComment("Warning: type declarations were not added automatically."); } writer.flush(); }