Refine search
XMLInputSource aeIputSource = new XMLInputSource(aeDescriptorPath); ResourceSpecifier aeSpecifier = UIMAFramework.getXMLParser() .parseResourceSpecifier(aeIputSource); AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(aeSpecifier);
/** * Simple method to load xml description and return an AnalysisEngineDescription object * @param pathToDescription * @return * @throws IOException * @throws InvalidXMLException */ public static AnalysisEngineDescription loadDescription(String pathToDescription) throws IOException, InvalidXMLException { File file = new File(pathToDescription); XMLParser parser = UIMAFramework.getXMLParser(); XMLInputSource source = new XMLInputSource(file); AnalysisEngineDescription desc = parser.parseAnalysisEngineDescription(source); return desc; }
/** * Instantiates a ResourceSpecifier from a given URL. * * @param aDescriptorUrl - URL of descriptor * @return - ResourceSpecifier * * @throws Exception - */ public ResourceSpecifier getSpecifier(URL aDescriptorUrl) throws Exception { XMLInputSource in = new XMLInputSource(aDescriptorUrl); return UIMAFramework.getXMLParser().parseResourceSpecifier(in); }
public static FlowControllerDescription getDescription() { URL descUrl = FixedFlowController.class .getResource("/org/apache/uima/flow/FixedFlowController.xml"); FlowControllerDescription desc; try { desc = (FlowControllerDescription) UIMAFramework.getXMLParser().parse( new XMLInputSource(descUrl)); } catch (InvalidXMLException e) { throw new UIMARuntimeException(e); } catch (IOException e) { throw new UIMARuntimeException(e); } return desc; }
@Override protected String getDescriptionFromImport(String source) throws InvalidXMLException, IOException { TypeSystemDescription parsedImportItem = UIMAFramework.getXMLParser() .parseTypeSystemDescription(new XMLInputSource(source)); return parsedImportItem.getDescription(); }
/** * Parses and returns the descriptor for this collection reader. The descriptor is stored in the * uima.jar file and located using the ClassLoader. * * @return an object containing all of the information parsed from the descriptor. * @throws InvalidXMLException if the descriptor is invalid or missing */ public static CasConsumerDescription getDescription() throws InvalidXMLException { InputStream descStream = XmiWriterCasConsumerCtakes.class .getResourceAsStream( "XmiWriterCasConsumerCtakes.xml" ); return UIMAFramework.getXMLParser().parseCasConsumerDescription( new XMLInputSource( descStream, null ) ); }
AnalysisEngineDescription taeDescription = UIMAFramework.getXMLParser().parseAnalysisEngineDescription( new XMLInputSource(new File(taeDescriptionLocation))); AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(taeDescription); System.out.println("analysis engine created."); CasConsumerDescription casConsumerDescription = UIMAFramework.getXMLParser().parseCasConsumerDescription( new XMLInputSource(new File(casConsumerDescriptorLocation))); CasConsumer casConsumer = UIMAFramework.produceCasConsumer(casConsumerDescription); System.out.println("CasConsumer initialized. Calling processCas....");
/** * Returns an analysis engine for the given annotator. * * @param annotator is the name of the annotator (with or without .xml * extension). * @return the AnalysisEngine */ public static AnalysisEngine getAnalysisEngine(String annotator) { // Try to find the URL pointing at the annotator resource URL resource = Typesystem.class.getResource(getAnnotator(annotator)); if (resource == null) { throw new TypesystemException("Annotator " + annotator + " not found", null); } // Create the AnalysisEngine try { final XMLInputSource xml = new XMLInputSource(resource); final AnalysisEngineDescription aeDescription = UIMAFramework.getXMLParser().parseAnalysisEngineDescription(xml); return UIMAFramework.produceAnalysisEngine(aeDescription); } catch (UIMAException | IOException ex) { throw new TypesystemException("getAnalysisEngine failed", ex); } }
public static void main(String[] args) throws IOException, UIMAException, CpeDescriptorException { if (args.length != 1) { System.err.println("Usage: <cpeDescriptorPath>"); return; } String cpeDescPath = args[0]; XMLInputSource cpeDescSource = new XMLInputSource(cpeDescPath); CpeDescription cpeDesc = UIMAFramework.getXMLParser().parseCpeDescription(cpeDescSource); // produce CollectionProcessingEngine cpe = UIMAFramework .produceCollectionProcessingEngine(cpeDesc); cpe.addStatusCallbackListener(new ReportingStatusCallbackListener(cpe)); // run cpe.process(); } }
xmlSource = (xmlDescFile != null) ? new XMLInputSource(xmlDescFile) : new XMLInputSource( xmlDescUrl); xmlSource.getInputStream().close(); } catch (Exception e) { xmlSource = (xmlDescFile != null) ? new XMLInputSource(xmlDescFile) : new XMLInputSource(xmlDescUrl); try { xmlSource.getInputStream().close(); } catch (Exception e) { xmlSource = (xmlDescFile != null) ? new XMLInputSource(xmlDescFile) : new XMLInputSource(xmlDescUrl); try { xmlSource.getInputStream().close(); } catch (Exception e) { xmlSource = (xmlDescFile != null) ? new XMLInputSource(xmlDescFile) : new XMLInputSource(xmlDescUrl); try { __errTableByUri.put( xmlDescUri, err ); } finally { if (xmlSource != null && xmlSource.getInputStream() != null) try { xmlSource.getInputStream().close(); } catch (Exception e) {
public static CollectionReader getCR(File collectionReaderDescriptorFile) throws ResourceInitializationException { try { XMLInputSource xmlInputSource = new XMLInputSource(collectionReaderDescriptorFile); XMLParser xmlParser = UIMAFramework.getXMLParser(); ResourceSpecifier resourceSpecifier = xmlParser.parseResourceSpecifier(xmlInputSource); CollectionReader collectionReader = UIMAFramework.produceCollectionReader(resourceSpecifier); return collectionReader; } catch (IOException ioe) { throw new ResourceInitializationException(ioe); } catch (InvalidXMLException ixe) { throw new ResourceInitializationException(ixe); } }
public void initTypeDescriptor(String cpeDescriptor) { ArrayList<TypeSystemDescription> typeSystems = new ArrayList<>(); try { currentCpeDesc = UIMAFramework.getXMLParser().parseCpeDescription(new XMLInputSource(cpeDescriptor)); removeFailedDescriptors(new File(cpeDescriptor)); File rootFolder = new File(currentCpeDesc.getSourceUrl().getFile()).getParentFile(); for (CpeCollectionReader collReader : collRdrs) { File descFile = new File(rootFolder + System.getProperty("file.separator") + collReader.getDescriptor().getImport().getLocation()); CollectionReaderDescription crd = UIMAFramework.getXMLParser().parseCollectionReaderDescription(new XMLInputSource(descFile)); TypeSystemDescription typeSystem = crd.getCollectionReaderMetaData().getTypeSystem(); typeSystem.resolveImports(); AnalysisEngineDescription aed = UIMAFramework.getXMLParser().parseAnalysisEngineDescription(new XMLInputSource(descFile)); TypeSystemDescription typeSystem = aed.getAnalysisEngineMetaData().getTypeSystem(); typeSystem.resolveImports();
private TypeSystemDescription getLocalTSD(String toLoad) throws InvalidXMLException, IOException { TypeSystemDescription localTSD = localTSDMap.get(toLoad); if (localTSD == null) { String locateTSD = locate(toLoad, descriptorPaths, "TypeSystem.xml", true); if (locateTSD != null) { localTSD = UIMAFramework.getXMLParser().parseTypeSystemDescription( new XMLInputSource(locateTSD)); ResourceManager resMgr = UIMAFramework.newDefaultResourceManager(); resMgr.setDataPath(getDataPath()); localTSD.resolveImports(resMgr); localTSDMap.put(toLoad, localTSD); } } return localTSD; }
/** * used when hovering. * * @param source the source * @return the description from import * @throws InvalidXMLException the invalid XML exception * @throws IOException Signals that an I/O exception has occurred. */ @Override protected String getDescriptionFromImport(String source) throws InvalidXMLException, IOException { FsIndexCollection parsedImportItem = UIMAFramework.getXMLParser().parseFsIndexCollection( new XMLInputSource(source)); return parsedImportItem.getDescription(); }
/** * used when hovering. * * @param source the source * @return the description from import * @throws InvalidXMLException the invalid XML exception * @throws IOException Signals that an I/O exception has occurred. */ @Override protected String getDescriptionFromImport(String source) throws InvalidXMLException, IOException { TypePriorities parsedImportItem = UIMAFramework.getXMLParser().parseTypePriorities( new XMLInputSource(source)); return parsedImportItem.getDescription(); }
ResourceSpecifier dlgSpecifier = null; try { xmlSource = new XMLInputSource(dlgDescPath); XMLParser xmlParser = UIMAFramework.getXMLParser(); dlgSpecifier = xmlParser.parseResourceSpecifier(xmlSource); } catch (InvalidXMLException xmlExc) { String msgKey = xmlExc.getMessageKey(); if (xmlSource != null) { try { xmlSource.getInputStream().close(); } catch (Exception e) {
public static CpeDescription loadCpeDescription(Path path) throws BiomedicusException { CpeDescription cpeDescription; try { XMLInputSource inputSource = new XMLInputSource(path.toFile()); cpeDescription = UIMAFramework.getXMLParser().parseCpeDescription(inputSource); } catch (InvalidXMLException | IOException e) { throw new BiomedicusException(e); } return cpeDescription; } }
/** * Parses and returns the descriptor for this collection reader. The descriptor is stored in the * uima.jar file and located using the ClassLoader. * * @return an object containing all of the information parsed from the descriptor. * * @throws InvalidXMLException * if the descriptor is invalid or missing */ public static CollectionReaderDescription getDescription() throws InvalidXMLException { InputStream descStream = FileSystemCollectionReader.class .getResourceAsStream("FileSystemCollectionReader.xml"); return UIMAFramework.getXMLParser().parseCollectionReaderDescription( new XMLInputSource(descStream, null)); }
xmlIn = new XMLInputSource(this.pkgBrowser.getInstallationDescriptor() .getMainComponentDesc()); TypeSystemDescription tsDescription = UIMAFramework.getXMLParser().parseTypeSystemDescription( xmlIn); TypePriorities tPriorities = UIMAFramework.getResourceSpecifierFactory().createTypePriorities(); FsIndexDescription[] fsIndexes = new FsIndexDescription[0]; CAS cas = CasCreationUtils.createCas(tsDescription, tPriorities, fsIndexes); xmlIn.close();
private void resolveImport(URL aURL, Collection<String> aAlreadyImportedURLs, Collection<ExternalResourceDescription> aResultResources, Collection<ExternalResourceBinding> aResultBindings, ResourceManager aResourceManager) throws InvalidXMLException, IOException { XMLInputSource input = new XMLInputSource(aURL); ResourceManagerConfiguration desc = UIMAFramework.getXMLParser() .parseResourceManagerConfiguration(input); desc.resolveImports(aAlreadyImportedURLs, aResourceManager); aResultResources.addAll(Arrays.asList(desc.getExternalResources())); aResultBindings.addAll(Arrays.asList(desc.getExternalResourceBindings())); }