Package org.apache.uima.resource.metadata

Examples of org.apache.uima.resource.metadata.TypeSystemDescription


    File preFile = new File(preFilePath);
    if (preFile.exists() == false || StringUtils.isEmpty(preFilePath)) {
      printErrorDialog("The preprocessing file was not found!");
      return null;
    }
    TypeSystemDescription defaultTypeSystemDescription = null;
    List<String> types = new ArrayList<String>();
    try {
      String tsDesc = RutaProjectUtils.getTypeSystemDescriptorPath(location,
              resource.getProject()).toPortableString();
      defaultTypeSystemDescription = UIMAFramework.getXMLParser().parseTypeSystemDescription(
              new XMLInputSource(new File(tsDesc)));
      defaultTypeSystemDescription.resolveImports();
      TypeDescription[] systemTypes = defaultTypeSystemDescription.getTypes();
      Set<String> set = new HashSet<String>();
      for (TypeDescription typeDescription : systemTypes) {
        set.add(typeDescription.getName());
      }
      types.addAll(set);
View Full Code Here


          .getActiveWorkbenchWindow(event).getWorkbench()
          .getActiveWorkbenchWindow().getActivePage()
          .showView(AnnotationCheckView.ID);
      AnnotationCheckComposite composite = (AnnotationCheckComposite) acView
          .getComposite();
      TypeSystemDescription tsd = composite.getTypeSystemDescription();
      tsd.resolveImports();
      Display display = Display.getDefault();
      Shell shell = new Shell(display, SWT.RESIZE | SWT.APPLICATION_MODAL
          | SWT.DIALOG_TRIM);
      shell.setText("Checked Types");
      SelectTypesDialogCheck dialog = new SelectTypesDialogCheck(shell,
View Full Code Here

    File preFile = new File(preFilePath);
    if (preFile.exists() == false || StringUtils.isEmpty(preFilePath)) {
      printErrorDialog("The preprocessing file was not found!");
      return null;
    }
    TypeSystemDescription defaultTypeSystemDescription = null;
    List<String> types = new ArrayList<String>();
    try {
      String tsDesc = RutaProjectUtils.getTypeSystemDescriptorPath(location, resource.getProject())
              .toPortableString();

      defaultTypeSystemDescription = UIMAFramework.getXMLParser().parseTypeSystemDescription(
              new XMLInputSource(new File(tsDesc)));
      defaultTypeSystemDescription.resolveImports();
      TypeDescription[] systemTypes = defaultTypeSystemDescription.getTypes();
      Set<String> set = new HashSet<String>();
      for (TypeDescription typeDescription : systemTypes) {
        set.add(typeDescription.getName());
      }
      types.addAll(set);
View Full Code Here

    URL aedesc = RutaEngine.class.getResource("BasicEngine.xml");
    XMLInputSource inae = new XMLInputSource(aedesc);
    ResourceSpecifier specifier = UIMAFramework.getXMLParser().parseResourceSpecifier(inae);
    ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
    AnalysisEngineDescription aed = (AnalysisEngineDescription) specifier;
    TypeSystemDescription basicTypeSystem = aed.getAnalysisEngineMetaData().getTypeSystem();
    if (!typeSystemLocation.equals("")) {
      String tsLocation = typeSystemLocation;
      Collection<TypeSystemDescription> tsds = new ArrayList<TypeSystemDescription>();
      tsds.add(basicTypeSystem);
      if (typeSystemLocation.endsWith(".ruta")) {
        IFile iFile = RutaAddonsPlugin.getIFile(typeSystemLocation);
        IPath scriptPath = iFile.getLocation();
        IProject project = iFile.getProject();
        IPath descriptorRootPath = RutaProjectUtils.getDescriptorRootPath(project);
        resMgr.setDataPath(descriptorRootPath.toPortableString());
        IPath path = RutaProjectUtils.getTypeSystemDescriptorPath(scriptPath, project);
        tsLocation = path.toPortableString();
      }
      File tsFile = new File(tsLocation);
      XMLInputSource ints = new XMLInputSource(tsFile);
      TypeSystemDescription importTSD = UIMAFramework.getXMLParser().parseTypeSystemDescription(
              ints);
      importTSD.resolveImports(resMgr);
      tsds.add(importTSD);
      TypeSystemDescription mergeTypeSystems = CasCreationUtils.mergeTypeSystems(tsds);
      aed.getAnalysisEngineMetaData().setTypeSystem(mergeTypeSystems);
    }
    aed.resolveImports(resMgr);
    ae = UIMAFramework.produceAnalysisEngine(aed, resMgr, null);
    File tempFile = File.createTempFile("RutaCDE", RutaEngine.SCRIPT_FILE_EXTENSION);
View Full Code Here

    if (!(composite instanceof AnnotationCheckComposite)) {
      return;
    }
    annotCheckCompo = (AnnotationCheckComposite) composite;
    shell.setText("Change annotation type");
    TypeSystemDescription tsd = annotCheckCompo.getTypeSystemDescription();
    SelectTypesDialogCheck dialog = new SelectTypesDialogCheck(shell, tsd, null, false, SWT.SINGLE,
            false);
    String newTypeName = null;
    if (dialog.open() == Window.OK) {
      newTypeName = dialog.getChoosenType();
View Full Code Here

  public void save() {
    AnnotationCheckTreeNode root = (AnnotationCheckTreeNode) treeView.getInput();
    AnnotationCheckTreeNode[] children = root.getChildren();
    List<CheckDocument> docs = new ArrayList<CheckDocument>(oldDocs);
    TypeSystemDescription tsd = getTypeSystemDescription();
    CAS casSource = null;
    CAS cas = null;
    try {
      cas = CasCreationUtils.createCas(tsd, null, new FsIndexDescription[0]);
      casSource = CasCreationUtils.createCas(tsd, null, new FsIndexDescription[0]);
View Full Code Here

  }

  public void refreshTypeSystem() {
    try {
      String typeSystem = getPathToTypeSystem();
      TypeSystemDescription tsd = UIMAFramework.getXMLParser().parseTypeSystemDescription(
              new XMLInputSource(new File(typeSystem)));
      tsd.resolveImports();
      this.tsd = tsd;
    } catch (InvalidXMLException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
View Full Code Here

    AnnotationCheckView acView;
    try {
      acView = (AnnotationCheckView) HandlerUtil.getActiveWorkbenchWindow(event).getWorkbench()
              .getActiveWorkbenchWindow().getActivePage().showView(AnnotationCheckView.ID);
      AnnotationCheckComposite composite = (AnnotationCheckComposite) acView.getComposite();
      TypeSystemDescription tsd = composite.getTypeSystemDescription();
      tsd.resolveImports();
      Display display = Display.getDefault();
      Shell shell = new Shell(display);
      shell.setText("Unchecked Types");
      SelectTypesDialogCheck dialog = new SelectTypesDialogCheck(shell, tsd,
              composite.getUncheckedTypes(), false, SWT.MULTI, true);
View Full Code Here

      CAS testCas = null;
      try {
        URL tpUrl = this.getClass().getResource("/org/apache/uima/ruta/engine/TypePriorities.xml");
        TypePriorities typePriorities = UIMAFramework.getXMLParser().parseTypePriorities(
                new XMLInputSource(tpUrl));
        TypeSystemDescription descriptor = (TypeSystemDescription) UIMAFramework.getXMLParser()
                .parse(new XMLInputSource(typeSystem));
        inputCAS = CasCreationUtils
                .createCas(descriptor, typePriorities, new FsIndexDescription[0]);
        testCas = CasCreationUtils.createCas(descriptor, null, new FsIndexDescription[0]);
      } catch (Exception e) {
View Full Code Here

   * @param casTS Type system containing all known types.
   * @throws InvalidXMLException When import cannot be resolved.
   */
  private void importDeclaredTypesystems(TypeSystem casTS) throws InvalidXMLException {
    String[] descriptors = typesystems.toArray(new String[typesystems.size()]);
    TypeSystemDescription ts = TypeSystemDescriptionFactory.createTypeSystemDescription(descriptors);
    ts.resolveImports();
    for (TypeDescription td : ts.getTypes()) {
      Type type = casTS.getType(td.getName());
      if (type != null) {
        addType(type);
      } else {
        throw new RuntimeException("Type '" + td.getName() + "' not found");
View Full Code Here

TOP

Related Classes of org.apache.uima.resource.metadata.TypeSystemDescription

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.