[ 
https://issues.apache.org/jira/browse/UIMA-3303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13783740#comment-13783740
 ] 

Richard Eckart de Castilho commented on UIMA-3303:
--------------------------------------------------

I think the following two suggestions are redundant:

{noformat}
IMPORT PACKAGE <package> (FROM <typesystemfile>)? AS <prefix> -- make the 
specified package from typesystemfile (or detected automatically) available 
using prefix
IMPORT <package>.* (FROM <typesystemfile>)? -- make all the types from the 
specified package and typesystemfile (or detected automatically) available in 
the current namespace
{noformat}

They can be merged into this

{noformat}
IMPORT PACKAGE <package> (FROM <typesystemfile>)? (AS <prefix>?) -- make the 
specified package from typesystemfile (or detected automatically) available 
using prefix or in the current namespace if no prefix is given
{noformat}

Looking back, I'm also a bit confused about these:

{noformat}
IMPORT * FROM <typesystemfile> -- make all the types from typesystem available 
in the current namespace
IMPORT FROM <typesystemfile>   -- shorthand
IMPORT TYPESYSTEM <typesystemfile> -- make all the types from typesystem 
available using their long name
{noformat}

and think they could be merged into this

{noformat}
IMPORT PACKAGE <package> FROM <typesystemfile> (AS <prefix>?) --  make all 
types from package in type system available under prefix
IMPORT FROM <typesystemfile> -- make all the types from the type system 
available using long
{noformat}

Maybe we should switch to some kind of grammar notation (and maybe to the 
wiki...):

{noformat}
import := "IMPORT" (all|package|type) ("FROM" source)? (AS (alias))?
all := "*" | ""  // Allows import with long names
package := "PACKAGE" <package name> // Allows imports with short names
type := <type name> // Allows imports of single types
source := qualifiedClasspathSource | unqualifiedClasspathSource
qualifiedClasspathSource := <org.apache.uima.types.MyTypes>
unqualifiedClasspathSource := <MyTypes> // Implicitly import from script package
alias := <package alias (prefix) or type alias (alternative type name)>
{noformat}


> Add a way to alias types in RUTA (e.g. "IMPORT type AS alias")
> --------------------------------------------------------------
>
>                 Key: UIMA-3303
>                 URL: https://issues.apache.org/jira/browse/UIMA-3303
>             Project: UIMA
>          Issue Type: Bug
>          Components: ruta
>            Reporter: Alexandre Patry
>            Assignee: Alexandre Patry
>
> It would be convenient to define type aliases in RUTA script.
> One scenario where it would help is when many types have the same short name:
> {noformat}
> IMPORT com.example.a.T AS TA
> IMPORT com.example.b.T AS TB
> {noformat}
> For a discussion about it, see UIMA-3292.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to