[
https://issues.apache.org/jira/browse/UIMA-3303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13785821#comment-13785821
]
Alexandre Patry commented on UIMA-3303:
---------------------------------------
At first, I wanted to restrict the usage of long types and short types, hence
the confusion. From our discussion, I think it was not a good idea.
{quote}
The idea here is to import everything that is in a certain type system file by
its full names. Of course, the type system may define multiple packages, but
that's exactly the point here. You may not want to import each separately.
{quote}
Using the same alias to refer to types in different packages is strange to me,
but I have no real problem with it.
{quote}
Btw. there is no idea yet how <typesystem> can be written. I suppose the
default case would be to look in the classpath, e.g.:
{noformat}
1) IMPORT * FROM org.apache.uima.ruta.MyTypes
{noformat}
Options could be also
{noformat}
2) IMPORT * FROM MyTypes -- automatically pre-pending package name of Ruta
script
3) IMPORT * FROM file:///home/MyTypes.xml -- import from local file
4) IMPORT * FROM http://uima.apache.org/ruta/1.0/officialtypes.xml -- import
from remote file
5) IMPORT * FROM classpath*:org/apache/uima/ruta/**/types/*.xml -- import from
all type descriptors in these packages (Spring syntax)
{noformat}
{quote}
That is a really good point. Right now, RUTA uses #1 to import typesystems,
script, engine and uimafit engines. I think an alternative syntax should be
ported to all of these and should be part of another issue.
{quote}
{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}
{quote}
I really like your suggestion but would postpone unqualifiedClasspathSource.
> 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)