@Override @Nullable public final String getDefaultMIMEType() { return format.getDefaultMIMEType(); }
@Override public final List<String> getMIMETypes() { return format.getMIMETypes(); }
@Override public final boolean handlesMimeType(String mimeType) { return format.handlesMimeType(mimeType); } }
@Override public boolean equals(@Nullable Object obj) { if (null == obj) { return false; } if (obj == this) { return true; } if (!(obj instanceof OWLDocumentFormatFactory)) { return false; } OWLDocumentFormatFactory otherFactory = (OWLDocumentFormatFactory) obj; return getKey().equals(otherFactory.getKey()); } }
@Override public boolean canStoreOntology(OWLDocumentFormat ontologyFormat) { return ontFormat.createFormat().equals(ontologyFormat); }
public ParseErrorsPanel(UnparsableOntologyException e, final URI loc) { setLayout(new BorderLayout(12, 12)); tabs = new JTabbedPane(); tabs.setPreferredSize(new Dimension(700, 500)); final java.util.List<OWLParser> parsers = new ArrayList<>(e.getExceptions().keySet()); int counter = 1; for (OWLParser parser : parsers){ Throwable parseError = e.getExceptions().get(parser); ErrorExplainer.ErrorExplanation<? extends Throwable> explanation = errorExplainer.getErrorExplanation(parseError, true); final ErrorPanel<? extends Throwable> errorPanel = new ParseErrorPanel<>(explanation, loc); OWLDocumentFormatFactory supportedFormatFactory = parser.getSupportedFormat(); OWLDocumentFormat documentFormat = supportedFormatFactory.get(); tabs.addTab("(" + counter + ") " + documentFormat.getKey(), errorPanel); counter++; } add(new JLabel("<html>Could not parse the ontology found at: " + loc + "<p>The following formats were tried:</html>"), BorderLayout.NORTH); add(tabs, BorderLayout.CENTER); } }
@Override public boolean equals(@Nullable Object obj) { if (null == obj) { return false; } if (obj == this) { return true; } if (!(obj instanceof OWLDocumentFormatFactory)) { return false; } OWLDocumentFormatFactory otherFactory = (OWLDocumentFormatFactory) obj; return getKey().equals(otherFactory.getKey()); } }
@Override public boolean canStoreOntology(OWLDocumentFormat ontologyFormat) { return ontFormat.createFormat().equals(ontologyFormat); }
public ParseErrorsPanel(UnparsableOntologyException e, final URI loc) { setLayout(new BorderLayout(12, 12)); tabs = new JTabbedPane(); tabs.setPreferredSize(new Dimension(700, 500)); final java.util.List<OWLParser> parsers = new ArrayList<>(e.getExceptions().keySet()); int counter = 1; for (OWLParser parser : parsers){ Throwable parseError = e.getExceptions().get(parser); ErrorExplainer.ErrorExplanation<? extends Throwable> explanation = errorExplainer.getErrorExplanation(parseError, true); final ErrorPanel<? extends Throwable> errorPanel = new ParseErrorPanel<>(explanation, loc); OWLDocumentFormatFactory supportedFormatFactory = parser.getSupportedFormat(); OWLDocumentFormat documentFormat = supportedFormatFactory.get(); tabs.addTab("(" + counter + ") " + documentFormat.getKey(), errorPanel); counter++; } add(new JLabel("<html>Could not parse the ontology found at: " + loc + "<p>The following formats were tried:</html>"), BorderLayout.NORTH); add(tabs, BorderLayout.CENTER); } }
@Override public boolean equals(@Nullable Object obj) { if (null == obj) { return false; } if (obj == this) { return true; } if (!(obj instanceof OWLDocumentFormatFactory)) { return false; } OWLDocumentFormatFactory otherFactory = (OWLDocumentFormatFactory) obj; return getKey().equals(otherFactory.getKey()); } }
@Override public final boolean handlesMimeType(String mimeType) { return format.handlesMimeType(mimeType); } }
@Override @Nullable public final String getDefaultMIMEType() { return format.getDefaultMIMEType(); }
@Override public final List<String> getMIMETypes() { return format.getMIMETypes(); }
/** * @return A fresh instance of the matching {@link OWLDocumentFormat} for this OWLAPIRDFFormat. */ public OWLDocumentFormat getOWLFormat() { if (owlFormatFactory != null) { return owlFormatFactory.createFormat(); } try { return verifyNotNull(owlFormat).getClass().newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new OWLRuntimeException( "Format did not have a factory or a public default constructor", e); } } }
/** * Use the format to select a sublist of parsers. * * @param format document format * @param parsers parsers * @return candidate parsers */ private static PriorityCollection<OWLParserFactory> getParsersByFormat(OWLDocumentFormat format, PriorityCollection<OWLParserFactory> parsers) { PriorityCollection<OWLParserFactory> candidateParsers = new PriorityCollection<>(PriorityCollectionSorting.NEVER); for (OWLParserFactory parser : parsers) { if (parser.getSupportedFormat().getKey().equals(format.getKey())) { candidateParsers.add(parser); } } return candidateParsers; }
@Override public final boolean handlesMimeType(String mimeType) { return format.handlesMimeType(mimeType); } }
@Override @Nullable public final String getDefaultMIMEType() { return format.getDefaultMIMEType(); }
@Override public final List<String> getMIMETypes() { return format.getMIMETypes(); }
/** * @return A fresh instance of the matching {@link OWLDocumentFormat} for this OWLAPIRDFFormat. */ public OWLDocumentFormat getOWLFormat() { if (owlFormatFactory != null) { return owlFormatFactory.createFormat(); } try { return verifyNotNull(owlFormat).getClass().newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new OWLRuntimeException( "Format did not have a factory or a public default constructor", e); } } }
/** * Use the format to select a sublist of parsers. * * @param format document format * @param parsers parsers * @return candidate parsers */ private static PriorityCollection<OWLParserFactory> getParsersByFormat(OWLDocumentFormat format, PriorityCollection<OWLParserFactory> parsers) { PriorityCollection<OWLParserFactory> candidateParsers = new PriorityCollection<>(PriorityCollectionSorting.NEVER); for (OWLParserFactory parser : parsers) { if (parser.getSupportedFormat().getKey().equals(format.getKey())) { candidateParsers.add(parser); } } return candidateParsers; }