You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ctakes.apache.org by Reed Villanueva <vi...@gmail.com> on 2018/04/04 23:00:00 UTC

How to add /desc and /resources to intellij IDEA project?

As the title states, I am having trouble understanding where to place the
/resources (and /desc ?) folders in an intellij IDEA project that is trying
to use ctakes (don't work with java often).

*TLDR: In intellij, how do I use the resources/ and des/ folders that come
in ctakes binary distributions? What is going on under the surface that
lets these things be recognized and used (even when outside of intellij)?*

Currently I have added the jars by copying them to some folder and pointing
intellij to that folder as a library in the File --> Project Structure. The
way I am using the resources/ folder right now is by having it in the same
folder as a src folder in the intellij project ("marked as" as "source"
folder) and using the context menu on this resources/ copy to "mark as" a
"resource root".

Testing with a simple variation of the HelloWorldAggregatePipeline.java
that can be found in the ctakes trunk/ctakes-examples/..., the code seems
to run, but I see errors like:

** Configuration Error:
> file:$PROJECT_HOME/project/out/production/project/org/apache/ctakes/lvg/data/config/lvg.properties
> (No such file or directory)
> ** Error: problem of opening/reading config file: 'file:$PROJECT_HOME/project/out/production/project/org/apache/ctakes/lvg/data/config/lvg.properties'.
> Use -x option to specify the config file path.
> ** Configuration Error: file:$PROJECT_HOME/project/out/production/project/org/apache/ctakes/lvg/data/config/lvg.properties
> (No such file or directory)
> ** Error: problem of opening/reading config file: 'file:$PROJECT_HOME/project/out/production/project/org/apache/ctakes/lvg/data/config/lvg.properties'.
> Use -x option to specify the config file path.


even though, checking in that location of the project, properties is
clearly there and I can open it and see its contents.

This makes me suspect that I have not added them to the project correctly,
so what should be done? Thanks for advice.

Re: How to add /desc and /resources to intellij IDEA project? [EXTERNAL]

Posted by Reed Villanueva <vi...@gmail.com>.
I see, I have added a small change proposal to the ctakes JIRA (
https://issues.apache.org/jira/browse/CTAKES-504).
Thanks.

On Fri, Apr 6, 2018 at 10:48 AM, Finan, Sean <
Sean.Finan@childrens.harvard.edu> wrote:

> Of course!  You can submit a jira item regarding the documentation or if
> you have permissions for the wiki you can create or edit a page yourself.
>
> Sean
> ________________________________________
> From: Reed Villanueva <vi...@gmail.com>
> Sent: Friday, April 6, 2018 4:20 PM
> To: dev@ctakes.apache.org
> Subject: Re: How to add /desc and /resources to intellij IDEA project?
> [EXTERNAL]
>
> Ok, I see, thank you.
> One final thing, is there some kind of mechanism for myself or others to
> somehow request to, say, add edits/changes to existing ctakes documentation
> where someone else reviews and approves it?
>
> On Fri, Apr 6, 2018 at 9:52 AM, Finan, Sean <
> Sean.Finan@childrens.harvard.edu> wrote:
>
> > Hi Reed,
> >
> > lookupXml is a parameter that is sent to ctakes, not the vm.  But yes,
> you
> > can place "--lookupXml <path>" or simply "-l <path>" to the command line
> if
> > you are running the default pipeline.
> >
> > The lookupXml points to a configuration file that can be anywhere, such
> as
> > in your $HOME.  However, you will need to edit that configuration file to
> > make sure that it points to your dictionary.  For instance, if you copy
> the
> > default sno_rx_16ab.xml from the ctakes resources/ area you should change
> > the jdbcUrl property to point to your dictionary database.  For instance:
> >
> >          <property key="jdbcUrl" value="jdbc:hsqldb:file:
> > resources/org/apache/ctakes/dictionary/lookup/fast/ncit_
> > plus_16ab/ncit_plus_16ab"/>
> >
> > You seem to be pretty savvy, so if you look in the default .xml the
> change
> > required should be pretty apparent.  Absolute paths are acceptable.
> >
> > You can't have more than one .xml file.  However, within the xml file you
> > can specify multiple dictionaries.
> >
> > Sean
> > ________________________________________
> > From: Reed Villanueva <vi...@gmail.com>
> > Sent: Friday, April 6, 2018 3:42 PM
> > To: dev@ctakes.apache.org
> > Subject: Re: How to add /desc and /resources to intellij IDEA project?
> > [EXTERNAL]
> >
> > I see, thanks.
> > So you're saying that I would do something like: add the option
> > "-LookupXml=$HOME/project/org/apache/ctakes/dictionary/
> > lookup/fast/sno_rx_16ab.xml"
> > to the VM options in the run configurations for my intellij project? Can
> > this be a comma-seperated list of locations?
> >
> > On Fri, Apr 6, 2018 at 9:32 AM, Finan, Sean <
> > Sean.Finan@childrens.harvard.edu> wrote:
> >
> > > Hi Reed,
> > >
> > > Wow, you went through a lot of trouble.  There actually is a much
> simpler
> > > solution.  It does need proper documentation as it is only hinted at in
> > [1]
> > > and [2].  You can put a dictionary anywhere you want.  Then either in
> > your
> > > piper file (configures pipeline) or the command line, or in the
> submitter
> > > gui [3], specify the LookupXml file location.   That xml file is what
> > > points to the dictionary database and specifies how it should be used.
> > >
> > > The best "how-to" is on the ctakes 4.0 wiki front page, the
> > > "pamphlet/manual" under Documentation. [4]
> > >
> > > Sean
> > >
> > > 1.
> > > https://urldefense.proofpoint.com/v2/url?u=https-3A__cwiki.
> > apache.org_confluence_display_CTAKES_Piper-2BFiles&d=DwIFaQ&
> > c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=
> > fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao&m=
> > FLRmd8JSLqAXw9SYsRUmX3CPjtNorqZf1HjjYLhacgE&s=MlCXUnzoIy-
> > QakQAx18Ebp1SCMp26o-7YBvqkDEnufI&e=
> > > 2.
> > > https://urldefense.proofpoint.com/v2/url?u=https-3A__cwiki.
> > apache.org_confluence_display_CTAKES_Dictionary-2BCreator-
> > 2BGUI&d=DwIFaQ&c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=
> > fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao&m=
> > FLRmd8JSLqAXw9SYsRUmX3CPjtNorqZf1HjjYLhacgE&s=2oP9-UEq_
> > Lhyvq9knIK7RCaPjgG10j_aYFs4HXlIlaQ&e=
> > > 3.
> > > https://urldefense.proofpoint.com/v2/url?u=https-3A__cwiki.
> > apache.org_confluence_display_CTAKES_&d=DwIFaQ&c=qS4goWBT7poplM69zy_
> > 3xhKwEW14JZMSdioCoppxeFU&r=fs67GvlGZstTpyIisCYNYmQCP6r0bc
> pKGd4f7d4gTao&m=
> > FLRmd8JSLqAXw9SYsRUmX3CPjtNorqZf1HjjYLhacgE&s=
> > MGt75pnvbaQqNsx48w2J8SIWjNjDNtjUGgzA5YkqdIk&e=
> > > Piper+File+Submitter+GUI
> > > 4.
> > > https://urldefense.proofpoint.com/v2/url?u=https-3A__cwiki.
> > apache.org_confluence_display_CTAKES_cTAKES-2B4.0&d=DwIFaQ&
> > c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=
> > fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao&m=
> > FLRmd8JSLqAXw9SYsRUmX3CPjtNorqZf1HjjYLhacgE&s=
> > DcBEnhBIVmzN8ai7tY6bwI1mxt1Unvloz-RdvU_JqWY&e=
> > >
> > >
> > >
> > > ________________________________________
> > > From: Reed Villanueva <vi...@gmail.com>
> > > Sent: Friday, April 6, 2018 3:16 PM
> > > To: dev@ctakes.apache.org
> > > Subject: Re: How to add /desc and /resources to intellij IDEA project?
> > > [EXTERNAL]
> > >
> > > ​​
> > > Fixed problem.
> > >
> > > Running similar program in the ctakes source trunk/examples...,
> > > ​I see that ​
> > > FileLocator.getResource() method should be using
> > > location=resources/org/apache/ctakes/dictionary/lookup/fast/
> > > sno_rx_16ab/sno_rx_16ab.script
> > > url=file:/home/
> > > ​me
> > > /projects/ctakes/trunk/resources/org/apache/ctakes/
> > > dictionary/lookup/fast/sno_rx_16ab/sno_rx_16ab.script
> > >
> > > Problem appears to be within FileLocator.getSearchPaths() not including
> > the
> > > location that I have the resource
> > > ​ ​
> > > folder in my project (
> > > ​which does not conform to​
> > > a certain convention
> > > ​ that the method seems to be expecting​
> > > (
> > > ​which
> > >  was never mentioned in the ctakes documentation
> > > ​ so far as I could find​
> > > )). The
> > > ​ relevant​
> > > code snippet from the intellij
> > > ​debugging tool
> > > ​ for the FileLocator.class​
> > > when debugging
> > > ​ looks like:
> > >
> > > ------------------------------------------------------------
> > > -------------------------------
> > >
> > > private static Collection<String> getFileSearchPaths(String location) {
> > >     Collection<String> paths = new ArrayList();
> > >
> > >     // getting current working directory (I assume being registered as
> > > my toplevel intellij project location)
> > >
> > > String dir = System.getProperty("user.dir");
> > > if (dir != null && !dir.isEmpty()) {
> > > paths.add(dir + "/" + location);
> > > paths.add(dir + "/resources/" + location);
> > > }
> > >
> > > String cTakesHome = System.getenv("CTAKES_HOME");
> > > if (cTakesHome != null && !cTakesHome.isEmpty()) {
> > > paths.add(cTakesHome + "/" + location);
> > > paths.add(cTakesHome + "/resources/" + location);
> > > }
> > >
> > > if (dir != null && !dir.isEmpty()) {
> > > File ancestor = new File(dir);
> > >
> > >         // then starting from the parent folder of the CWD...
> > >
> > > while(ancestor.getParentFile() != null) {
> > > ancestor = ancestor.getParentFile();
> > >
> > >             // ...recursively building back down into each "child"
> > > folder to form a list of possible paths following the conventions
> > > shown here
> > >
> > > paths.add(ancestor + "/" + location);
> > > paths.add(ancestor + "/ctakes/" + location);
> > > paths.add(ancestor + "/resources/" + location);
> > > }
> > > }
> > >
> > > return paths;
> > > }
> > >
> > > ------------------------------------------------------------
> > > -------------------------------
> > > ​
> > >
> > > ​Examining the "paths" variable before the function returns, I see that
> > it
> > > expects a certain absolute path convention (when the CTAKES_HOME env.
> > > variable is not explicitly set).
> > >
> > >
> > > Solution seemes to be to move the resources/ folder to one of the
> > locations
> > > that the ctakes-core FileLocator.class
> > > is expecting it to be.
> > > ​My previous project structure looked like:
> > >
> > > ​$HOME/
> > > ​    project/
> > >         play-space/
> > >             /resouces ("marked as" resource root in intellij)
> > >             /desc (still don't know if I even need this, so please let
> me
> > > know)
> > >             /src
> > >                 <my java files>
> > >
> > > ​changing this to
> > >
> > > ​$HOME/
> > > ​    project/
> > >         play-space/
> > >             /src
> > >                 <my java files>
> > >     /resouces ("marked as" resource root in intellij)
> > >     /desc (still don't know if I even need this, so please let me know)
> > >
> > > seems to have fixed that issue. If there is anything else I should know
> > > related to this issue that is not explicitly documented in the ctakes
> > docs,
> > > please let me know.
> > >
> > >
> > >
> > >
> > > On Wed, Apr 4, 2018 at 1:00 PM, Reed Villanueva <
> > villanuevareed@gmail.com>
> > > wrote:
> > >
> > > > As the title states, I am having trouble understanding where to place
> > the
> > > > /resources (and /desc ?) folders in an intellij IDEA project that is
> > > trying
> > > > to use ctakes (don't work with java often).
> > > >
> > > > *TLDR: In intellij, how do I use the resources/ and des/ folders that
> > > come
> > > > in ctakes binary distributions? What is going on under the surface
> that
> > > > lets these things be recognized and used (even when outside of
> > > intellij)?*
> > > >
> > > > Currently I have added the jars by copying them to some folder and
> > > > pointing intellij to that folder as a library in the File --> Project
> > > > Structure. The way I am using the resources/ folder right now is by
> > > having
> > > > it in the same folder as a src folder in the intellij project
> ("marked
> > > as"
> > > > as "source" folder) and using the context menu on this resources/
> copy
> > to
> > > > "mark as" a "resource root".
> > > >
> > > > Testing with a simple variation of the HelloWorldAggregatePipeline.
> > java
> > > > that can be found in the ctakes trunk/ctakes-examples/..., the code
> > seems
> > > > to run, but I see errors like:
> > > >
> > > > ** Configuration Error: file:$PROJECT_HOME/project/
> > > >> out/production/project/org/apache/ctakes/lvg/data/config/
> > lvg.properties
> > > >> (No such file or directory)
> > > >> ** Error: problem of opening/reading config file:
> 'file:$PROJECT_HOME
> > > >> /project/out/production/project/org/apache/ctakes/lvg/
> > > data/config/lvg.properties'.
> > > >> Use -x option to specify the config file path.
> > > >> ** Configuration Error: file:$PROJECT_HOME/project/
> > > >> out/production/project/org/apache/ctakes/lvg/data/config/
> > lvg.properties
> > > >> (No such file or directory)
> > > >> ** Error: problem of opening/reading config file:
> 'file:$PROJECT_HOME
> > > >> /project/out/production/project/org/apache/ctakes/lvg/
> > > data/config/lvg.properties'.
> > > >> Use -x option to specify the config file path.
> > > >
> > > >
> > > > even though, checking in that location of the project, properties is
> > > > clearly there and I can open it and see its contents.
> > > >
> > > > This makes me suspect that I have not added them to the project
> > > correctly,
> > > > so what should be done? Thanks for advice.
> > > >
> > >
> >
>

Re: How to add /desc and /resources to intellij IDEA project? [EXTERNAL]

Posted by "Finan, Sean" <Se...@childrens.harvard.edu>.
Of course!  You can submit a jira item regarding the documentation or if you have permissions for the wiki you can create or edit a page yourself.

Sean
________________________________________
From: Reed Villanueva <vi...@gmail.com>
Sent: Friday, April 6, 2018 4:20 PM
To: dev@ctakes.apache.org
Subject: Re: How to add /desc and /resources to intellij IDEA project? [EXTERNAL]

Ok, I see, thank you.
One final thing, is there some kind of mechanism for myself or others to
somehow request to, say, add edits/changes to existing ctakes documentation
where someone else reviews and approves it?

On Fri, Apr 6, 2018 at 9:52 AM, Finan, Sean <
Sean.Finan@childrens.harvard.edu> wrote:

> Hi Reed,
>
> lookupXml is a parameter that is sent to ctakes, not the vm.  But yes, you
> can place "--lookupXml <path>" or simply "-l <path>" to the command line if
> you are running the default pipeline.
>
> The lookupXml points to a configuration file that can be anywhere, such as
> in your $HOME.  However, you will need to edit that configuration file to
> make sure that it points to your dictionary.  For instance, if you copy the
> default sno_rx_16ab.xml from the ctakes resources/ area you should change
> the jdbcUrl property to point to your dictionary database.  For instance:
>
>          <property key="jdbcUrl" value="jdbc:hsqldb:file:
> resources/org/apache/ctakes/dictionary/lookup/fast/ncit_
> plus_16ab/ncit_plus_16ab"/>
>
> You seem to be pretty savvy, so if you look in the default .xml the change
> required should be pretty apparent.  Absolute paths are acceptable.
>
> You can't have more than one .xml file.  However, within the xml file you
> can specify multiple dictionaries.
>
> Sean
> ________________________________________
> From: Reed Villanueva <vi...@gmail.com>
> Sent: Friday, April 6, 2018 3:42 PM
> To: dev@ctakes.apache.org
> Subject: Re: How to add /desc and /resources to intellij IDEA project?
> [EXTERNAL]
>
> I see, thanks.
> So you're saying that I would do something like: add the option
> "-LookupXml=$HOME/project/org/apache/ctakes/dictionary/
> lookup/fast/sno_rx_16ab.xml"
> to the VM options in the run configurations for my intellij project? Can
> this be a comma-seperated list of locations?
>
> On Fri, Apr 6, 2018 at 9:32 AM, Finan, Sean <
> Sean.Finan@childrens.harvard.edu> wrote:
>
> > Hi Reed,
> >
> > Wow, you went through a lot of trouble.  There actually is a much simpler
> > solution.  It does need proper documentation as it is only hinted at in
> [1]
> > and [2].  You can put a dictionary anywhere you want.  Then either in
> your
> > piper file (configures pipeline) or the command line, or in the submitter
> > gui [3], specify the LookupXml file location.   That xml file is what
> > points to the dictionary database and specifies how it should be used.
> >
> > The best "how-to" is on the ctakes 4.0 wiki front page, the
> > "pamphlet/manual" under Documentation. [4]
> >
> > Sean
> >
> > 1.
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__cwiki.
> apache.org_confluence_display_CTAKES_Piper-2BFiles&d=DwIFaQ&
> c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=
> fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao&m=
> FLRmd8JSLqAXw9SYsRUmX3CPjtNorqZf1HjjYLhacgE&s=MlCXUnzoIy-
> QakQAx18Ebp1SCMp26o-7YBvqkDEnufI&e=
> > 2.
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__cwiki.
> apache.org_confluence_display_CTAKES_Dictionary-2BCreator-
> 2BGUI&d=DwIFaQ&c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=
> fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao&m=
> FLRmd8JSLqAXw9SYsRUmX3CPjtNorqZf1HjjYLhacgE&s=2oP9-UEq_
> Lhyvq9knIK7RCaPjgG10j_aYFs4HXlIlaQ&e=
> > 3.
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__cwiki.
> apache.org_confluence_display_CTAKES_&d=DwIFaQ&c=qS4goWBT7poplM69zy_
> 3xhKwEW14JZMSdioCoppxeFU&r=fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao&m=
> FLRmd8JSLqAXw9SYsRUmX3CPjtNorqZf1HjjYLhacgE&s=
> MGt75pnvbaQqNsx48w2J8SIWjNjDNtjUGgzA5YkqdIk&e=
> > Piper+File+Submitter+GUI
> > 4.
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__cwiki.
> apache.org_confluence_display_CTAKES_cTAKES-2B4.0&d=DwIFaQ&
> c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=
> fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao&m=
> FLRmd8JSLqAXw9SYsRUmX3CPjtNorqZf1HjjYLhacgE&s=
> DcBEnhBIVmzN8ai7tY6bwI1mxt1Unvloz-RdvU_JqWY&e=
> >
> >
> >
> > ________________________________________
> > From: Reed Villanueva <vi...@gmail.com>
> > Sent: Friday, April 6, 2018 3:16 PM
> > To: dev@ctakes.apache.org
> > Subject: Re: How to add /desc and /resources to intellij IDEA project?
> > [EXTERNAL]
> >
> > ​​
> > Fixed problem.
> >
> > Running similar program in the ctakes source trunk/examples...,
> > ​I see that ​
> > FileLocator.getResource() method should be using
> > location=resources/org/apache/ctakes/dictionary/lookup/fast/
> > sno_rx_16ab/sno_rx_16ab.script
> > url=file:/home/
> > ​me
> > /projects/ctakes/trunk/resources/org/apache/ctakes/
> > dictionary/lookup/fast/sno_rx_16ab/sno_rx_16ab.script
> >
> > Problem appears to be within FileLocator.getSearchPaths() not including
> the
> > location that I have the resource
> > ​ ​
> > folder in my project (
> > ​which does not conform to​
> > a certain convention
> > ​ that the method seems to be expecting​
> > (
> > ​which
> >  was never mentioned in the ctakes documentation
> > ​ so far as I could find​
> > )). The
> > ​ relevant​
> > code snippet from the intellij
> > ​debugging tool
> > ​ for the FileLocator.class​
> > when debugging
> > ​ looks like:
> >
> > ------------------------------------------------------------
> > -------------------------------
> >
> > private static Collection<String> getFileSearchPaths(String location) {
> >     Collection<String> paths = new ArrayList();
> >
> >     // getting current working directory (I assume being registered as
> > my toplevel intellij project location)
> >
> > String dir = System.getProperty("user.dir");
> > if (dir != null && !dir.isEmpty()) {
> > paths.add(dir + "/" + location);
> > paths.add(dir + "/resources/" + location);
> > }
> >
> > String cTakesHome = System.getenv("CTAKES_HOME");
> > if (cTakesHome != null && !cTakesHome.isEmpty()) {
> > paths.add(cTakesHome + "/" + location);
> > paths.add(cTakesHome + "/resources/" + location);
> > }
> >
> > if (dir != null && !dir.isEmpty()) {
> > File ancestor = new File(dir);
> >
> >         // then starting from the parent folder of the CWD...
> >
> > while(ancestor.getParentFile() != null) {
> > ancestor = ancestor.getParentFile();
> >
> >             // ...recursively building back down into each "child"
> > folder to form a list of possible paths following the conventions
> > shown here
> >
> > paths.add(ancestor + "/" + location);
> > paths.add(ancestor + "/ctakes/" + location);
> > paths.add(ancestor + "/resources/" + location);
> > }
> > }
> >
> > return paths;
> > }
> >
> > ------------------------------------------------------------
> > -------------------------------
> > ​
> >
> > ​Examining the "paths" variable before the function returns, I see that
> it
> > expects a certain absolute path convention (when the CTAKES_HOME env.
> > variable is not explicitly set).
> >
> >
> > Solution seemes to be to move the resources/ folder to one of the
> locations
> > that the ctakes-core FileLocator.class
> > is expecting it to be.
> > ​My previous project structure looked like:
> >
> > ​$HOME/
> > ​    project/
> >         play-space/
> >             /resouces ("marked as" resource root in intellij)
> >             /desc (still don't know if I even need this, so please let me
> > know)
> >             /src
> >                 <my java files>
> >
> > ​changing this to
> >
> > ​$HOME/
> > ​    project/
> >         play-space/
> >             /src
> >                 <my java files>
> >     /resouces ("marked as" resource root in intellij)
> >     /desc (still don't know if I even need this, so please let me know)
> >
> > seems to have fixed that issue. If there is anything else I should know
> > related to this issue that is not explicitly documented in the ctakes
> docs,
> > please let me know.
> >
> >
> >
> >
> > On Wed, Apr 4, 2018 at 1:00 PM, Reed Villanueva <
> villanuevareed@gmail.com>
> > wrote:
> >
> > > As the title states, I am having trouble understanding where to place
> the
> > > /resources (and /desc ?) folders in an intellij IDEA project that is
> > trying
> > > to use ctakes (don't work with java often).
> > >
> > > *TLDR: In intellij, how do I use the resources/ and des/ folders that
> > come
> > > in ctakes binary distributions? What is going on under the surface that
> > > lets these things be recognized and used (even when outside of
> > intellij)?*
> > >
> > > Currently I have added the jars by copying them to some folder and
> > > pointing intellij to that folder as a library in the File --> Project
> > > Structure. The way I am using the resources/ folder right now is by
> > having
> > > it in the same folder as a src folder in the intellij project ("marked
> > as"
> > > as "source" folder) and using the context menu on this resources/ copy
> to
> > > "mark as" a "resource root".
> > >
> > > Testing with a simple variation of the HelloWorldAggregatePipeline.
> java
> > > that can be found in the ctakes trunk/ctakes-examples/..., the code
> seems
> > > to run, but I see errors like:
> > >
> > > ** Configuration Error: file:$PROJECT_HOME/project/
> > >> out/production/project/org/apache/ctakes/lvg/data/config/
> lvg.properties
> > >> (No such file or directory)
> > >> ** Error: problem of opening/reading config file: 'file:$PROJECT_HOME
> > >> /project/out/production/project/org/apache/ctakes/lvg/
> > data/config/lvg.properties'.
> > >> Use -x option to specify the config file path.
> > >> ** Configuration Error: file:$PROJECT_HOME/project/
> > >> out/production/project/org/apache/ctakes/lvg/data/config/
> lvg.properties
> > >> (No such file or directory)
> > >> ** Error: problem of opening/reading config file: 'file:$PROJECT_HOME
> > >> /project/out/production/project/org/apache/ctakes/lvg/
> > data/config/lvg.properties'.
> > >> Use -x option to specify the config file path.
> > >
> > >
> > > even though, checking in that location of the project, properties is
> > > clearly there and I can open it and see its contents.
> > >
> > > This makes me suspect that I have not added them to the project
> > correctly,
> > > so what should be done? Thanks for advice.
> > >
> >
>

Re: How to add /desc and /resources to intellij IDEA project? [EXTERNAL]

Posted by Reed Villanueva <vi...@gmail.com>.
Ok, I see, thank you.
One final thing, is there some kind of mechanism for myself or others to
somehow request to, say, add edits/changes to existing ctakes documentation
where someone else reviews and approves it?

On Fri, Apr 6, 2018 at 9:52 AM, Finan, Sean <
Sean.Finan@childrens.harvard.edu> wrote:

> Hi Reed,
>
> lookupXml is a parameter that is sent to ctakes, not the vm.  But yes, you
> can place "--lookupXml <path>" or simply "-l <path>" to the command line if
> you are running the default pipeline.
>
> The lookupXml points to a configuration file that can be anywhere, such as
> in your $HOME.  However, you will need to edit that configuration file to
> make sure that it points to your dictionary.  For instance, if you copy the
> default sno_rx_16ab.xml from the ctakes resources/ area you should change
> the jdbcUrl property to point to your dictionary database.  For instance:
>
>          <property key="jdbcUrl" value="jdbc:hsqldb:file:
> resources/org/apache/ctakes/dictionary/lookup/fast/ncit_
> plus_16ab/ncit_plus_16ab"/>
>
> You seem to be pretty savvy, so if you look in the default .xml the change
> required should be pretty apparent.  Absolute paths are acceptable.
>
> You can't have more than one .xml file.  However, within the xml file you
> can specify multiple dictionaries.
>
> Sean
> ________________________________________
> From: Reed Villanueva <vi...@gmail.com>
> Sent: Friday, April 6, 2018 3:42 PM
> To: dev@ctakes.apache.org
> Subject: Re: How to add /desc and /resources to intellij IDEA project?
> [EXTERNAL]
>
> I see, thanks.
> So you're saying that I would do something like: add the option
> "-LookupXml=$HOME/project/org/apache/ctakes/dictionary/
> lookup/fast/sno_rx_16ab.xml"
> to the VM options in the run configurations for my intellij project? Can
> this be a comma-seperated list of locations?
>
> On Fri, Apr 6, 2018 at 9:32 AM, Finan, Sean <
> Sean.Finan@childrens.harvard.edu> wrote:
>
> > Hi Reed,
> >
> > Wow, you went through a lot of trouble.  There actually is a much simpler
> > solution.  It does need proper documentation as it is only hinted at in
> [1]
> > and [2].  You can put a dictionary anywhere you want.  Then either in
> your
> > piper file (configures pipeline) or the command line, or in the submitter
> > gui [3], specify the LookupXml file location.   That xml file is what
> > points to the dictionary database and specifies how it should be used.
> >
> > The best "how-to" is on the ctakes 4.0 wiki front page, the
> > "pamphlet/manual" under Documentation. [4]
> >
> > Sean
> >
> > 1.
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__cwiki.
> apache.org_confluence_display_CTAKES_Piper-2BFiles&d=DwIFaQ&
> c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=
> fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao&m=
> FLRmd8JSLqAXw9SYsRUmX3CPjtNorqZf1HjjYLhacgE&s=MlCXUnzoIy-
> QakQAx18Ebp1SCMp26o-7YBvqkDEnufI&e=
> > 2.
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__cwiki.
> apache.org_confluence_display_CTAKES_Dictionary-2BCreator-
> 2BGUI&d=DwIFaQ&c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=
> fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao&m=
> FLRmd8JSLqAXw9SYsRUmX3CPjtNorqZf1HjjYLhacgE&s=2oP9-UEq_
> Lhyvq9knIK7RCaPjgG10j_aYFs4HXlIlaQ&e=
> > 3.
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__cwiki.
> apache.org_confluence_display_CTAKES_&d=DwIFaQ&c=qS4goWBT7poplM69zy_
> 3xhKwEW14JZMSdioCoppxeFU&r=fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao&m=
> FLRmd8JSLqAXw9SYsRUmX3CPjtNorqZf1HjjYLhacgE&s=
> MGt75pnvbaQqNsx48w2J8SIWjNjDNtjUGgzA5YkqdIk&e=
> > Piper+File+Submitter+GUI
> > 4.
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__cwiki.
> apache.org_confluence_display_CTAKES_cTAKES-2B4.0&d=DwIFaQ&
> c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=
> fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao&m=
> FLRmd8JSLqAXw9SYsRUmX3CPjtNorqZf1HjjYLhacgE&s=
> DcBEnhBIVmzN8ai7tY6bwI1mxt1Unvloz-RdvU_JqWY&e=
> >
> >
> >
> > ________________________________________
> > From: Reed Villanueva <vi...@gmail.com>
> > Sent: Friday, April 6, 2018 3:16 PM
> > To: dev@ctakes.apache.org
> > Subject: Re: How to add /desc and /resources to intellij IDEA project?
> > [EXTERNAL]
> >
> > ​​
> > Fixed problem.
> >
> > Running similar program in the ctakes source trunk/examples...,
> > ​I see that ​
> > FileLocator.getResource() method should be using
> > location=resources/org/apache/ctakes/dictionary/lookup/fast/
> > sno_rx_16ab/sno_rx_16ab.script
> > url=file:/home/
> > ​me
> > /projects/ctakes/trunk/resources/org/apache/ctakes/
> > dictionary/lookup/fast/sno_rx_16ab/sno_rx_16ab.script
> >
> > Problem appears to be within FileLocator.getSearchPaths() not including
> the
> > location that I have the resource
> > ​ ​
> > folder in my project (
> > ​which does not conform to​
> > a certain convention
> > ​ that the method seems to be expecting​
> > (
> > ​which
> >  was never mentioned in the ctakes documentation
> > ​ so far as I could find​
> > )). The
> > ​ relevant​
> > code snippet from the intellij
> > ​debugging tool
> > ​ for the FileLocator.class​
> > when debugging
> > ​ looks like:
> >
> > ------------------------------------------------------------
> > -------------------------------
> >
> > private static Collection<String> getFileSearchPaths(String location) {
> >     Collection<String> paths = new ArrayList();
> >
> >     // getting current working directory (I assume being registered as
> > my toplevel intellij project location)
> >
> > String dir = System.getProperty("user.dir");
> > if (dir != null && !dir.isEmpty()) {
> > paths.add(dir + "/" + location);
> > paths.add(dir + "/resources/" + location);
> > }
> >
> > String cTakesHome = System.getenv("CTAKES_HOME");
> > if (cTakesHome != null && !cTakesHome.isEmpty()) {
> > paths.add(cTakesHome + "/" + location);
> > paths.add(cTakesHome + "/resources/" + location);
> > }
> >
> > if (dir != null && !dir.isEmpty()) {
> > File ancestor = new File(dir);
> >
> >         // then starting from the parent folder of the CWD...
> >
> > while(ancestor.getParentFile() != null) {
> > ancestor = ancestor.getParentFile();
> >
> >             // ...recursively building back down into each "child"
> > folder to form a list of possible paths following the conventions
> > shown here
> >
> > paths.add(ancestor + "/" + location);
> > paths.add(ancestor + "/ctakes/" + location);
> > paths.add(ancestor + "/resources/" + location);
> > }
> > }
> >
> > return paths;
> > }
> >
> > ------------------------------------------------------------
> > -------------------------------
> > ​
> >
> > ​Examining the "paths" variable before the function returns, I see that
> it
> > expects a certain absolute path convention (when the CTAKES_HOME env.
> > variable is not explicitly set).
> >
> >
> > Solution seemes to be to move the resources/ folder to one of the
> locations
> > that the ctakes-core FileLocator.class
> > is expecting it to be.
> > ​My previous project structure looked like:
> >
> > ​$HOME/
> > ​    project/
> >         play-space/
> >             /resouces ("marked as" resource root in intellij)
> >             /desc (still don't know if I even need this, so please let me
> > know)
> >             /src
> >                 <my java files>
> >
> > ​changing this to
> >
> > ​$HOME/
> > ​    project/
> >         play-space/
> >             /src
> >                 <my java files>
> >     /resouces ("marked as" resource root in intellij)
> >     /desc (still don't know if I even need this, so please let me know)
> >
> > seems to have fixed that issue. If there is anything else I should know
> > related to this issue that is not explicitly documented in the ctakes
> docs,
> > please let me know.
> >
> >
> >
> >
> > On Wed, Apr 4, 2018 at 1:00 PM, Reed Villanueva <
> villanuevareed@gmail.com>
> > wrote:
> >
> > > As the title states, I am having trouble understanding where to place
> the
> > > /resources (and /desc ?) folders in an intellij IDEA project that is
> > trying
> > > to use ctakes (don't work with java often).
> > >
> > > *TLDR: In intellij, how do I use the resources/ and des/ folders that
> > come
> > > in ctakes binary distributions? What is going on under the surface that
> > > lets these things be recognized and used (even when outside of
> > intellij)?*
> > >
> > > Currently I have added the jars by copying them to some folder and
> > > pointing intellij to that folder as a library in the File --> Project
> > > Structure. The way I am using the resources/ folder right now is by
> > having
> > > it in the same folder as a src folder in the intellij project ("marked
> > as"
> > > as "source" folder) and using the context menu on this resources/ copy
> to
> > > "mark as" a "resource root".
> > >
> > > Testing with a simple variation of the HelloWorldAggregatePipeline.
> java
> > > that can be found in the ctakes trunk/ctakes-examples/..., the code
> seems
> > > to run, but I see errors like:
> > >
> > > ** Configuration Error: file:$PROJECT_HOME/project/
> > >> out/production/project/org/apache/ctakes/lvg/data/config/
> lvg.properties
> > >> (No such file or directory)
> > >> ** Error: problem of opening/reading config file: 'file:$PROJECT_HOME
> > >> /project/out/production/project/org/apache/ctakes/lvg/
> > data/config/lvg.properties'.
> > >> Use -x option to specify the config file path.
> > >> ** Configuration Error: file:$PROJECT_HOME/project/
> > >> out/production/project/org/apache/ctakes/lvg/data/config/
> lvg.properties
> > >> (No such file or directory)
> > >> ** Error: problem of opening/reading config file: 'file:$PROJECT_HOME
> > >> /project/out/production/project/org/apache/ctakes/lvg/
> > data/config/lvg.properties'.
> > >> Use -x option to specify the config file path.
> > >
> > >
> > > even though, checking in that location of the project, properties is
> > > clearly there and I can open it and see its contents.
> > >
> > > This makes me suspect that I have not added them to the project
> > correctly,
> > > so what should be done? Thanks for advice.
> > >
> >
>

Re: How to add /desc and /resources to intellij IDEA project? [EXTERNAL]

Posted by "Finan, Sean" <Se...@childrens.harvard.edu>.
Hi Reed,

lookupXml is a parameter that is sent to ctakes, not the vm.  But yes, you can place "--lookupXml <path>" or simply "-l <path>" to the command line if you are running the default pipeline.

The lookupXml points to a configuration file that can be anywhere, such as in your $HOME.  However, you will need to edit that configuration file to make sure that it points to your dictionary.  For instance, if you copy the default sno_rx_16ab.xml from the ctakes resources/ area you should change the jdbcUrl property to point to your dictionary database.  For instance:

         <property key="jdbcUrl" value="jdbc:hsqldb:file:resources/org/apache/ctakes/dictionary/lookup/fast/ncit_plus_16ab/ncit_plus_16ab"/>

You seem to be pretty savvy, so if you look in the default .xml the change required should be pretty apparent.  Absolute paths are acceptable.

You can't have more than one .xml file.  However, within the xml file you can specify multiple dictionaries.  

Sean
________________________________________
From: Reed Villanueva <vi...@gmail.com>
Sent: Friday, April 6, 2018 3:42 PM
To: dev@ctakes.apache.org 
Subject: Re: How to add /desc and /resources to intellij IDEA project? [EXTERNAL]

I see, thanks.
So you're saying that I would do something like: add the option
"-LookupXml=$HOME/project/org/apache/ctakes/dictionary/lookup/fast/sno_rx_16ab.xml"
to the VM options in the run configurations for my intellij project? Can
this be a comma-seperated list of locations?

On Fri, Apr 6, 2018 at 9:32 AM, Finan, Sean <
Sean.Finan@childrens.harvard.edu> wrote:

> Hi Reed,
>
> Wow, you went through a lot of trouble.  There actually is a much simpler
> solution.  It does need proper documentation as it is only hinted at in [1]
> and [2].  You can put a dictionary anywhere you want.  Then either in your
> piper file (configures pipeline) or the command line, or in the submitter
> gui [3], specify the LookupXml file location.   That xml file is what
> points to the dictionary database and specifies how it should be used.
>
> The best "how-to" is on the ctakes 4.0 wiki front page, the
> "pamphlet/manual" under Documentation. [4]
>
> Sean
>
> 1.
> https://urldefense.proofpoint.com/v2/url?u=https-3A__cwiki.apache.org_confluence_display_CTAKES_Piper-2BFiles&d=DwIFaQ&c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao&m=FLRmd8JSLqAXw9SYsRUmX3CPjtNorqZf1HjjYLhacgE&s=MlCXUnzoIy-QakQAx18Ebp1SCMp26o-7YBvqkDEnufI&e=
> 2.
> https://urldefense.proofpoint.com/v2/url?u=https-3A__cwiki.apache.org_confluence_display_CTAKES_Dictionary-2BCreator-2BGUI&d=DwIFaQ&c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao&m=FLRmd8JSLqAXw9SYsRUmX3CPjtNorqZf1HjjYLhacgE&s=2oP9-UEq_Lhyvq9knIK7RCaPjgG10j_aYFs4HXlIlaQ&e=
> 3.
> https://urldefense.proofpoint.com/v2/url?u=https-3A__cwiki.apache.org_confluence_display_CTAKES_&d=DwIFaQ&c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao&m=FLRmd8JSLqAXw9SYsRUmX3CPjtNorqZf1HjjYLhacgE&s=MGt75pnvbaQqNsx48w2J8SIWjNjDNtjUGgzA5YkqdIk&e=
> Piper+File+Submitter+GUI
> 4.
> https://urldefense.proofpoint.com/v2/url?u=https-3A__cwiki.apache.org_confluence_display_CTAKES_cTAKES-2B4.0&d=DwIFaQ&c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao&m=FLRmd8JSLqAXw9SYsRUmX3CPjtNorqZf1HjjYLhacgE&s=DcBEnhBIVmzN8ai7tY6bwI1mxt1Unvloz-RdvU_JqWY&e=
>
>
>
> ________________________________________
> From: Reed Villanueva <vi...@gmail.com>
> Sent: Friday, April 6, 2018 3:16 PM
> To: dev@ctakes.apache.org
> Subject: Re: How to add /desc and /resources to intellij IDEA project?
> [EXTERNAL]
>
> ​​
> Fixed problem.
>
> Running similar program in the ctakes source trunk/examples...,
> ​I see that ​
> FileLocator.getResource() method should be using
> location=resources/org/apache/ctakes/dictionary/lookup/fast/
> sno_rx_16ab/sno_rx_16ab.script
> url=file:/home/
> ​me
> /projects/ctakes/trunk/resources/org/apache/ctakes/
> dictionary/lookup/fast/sno_rx_16ab/sno_rx_16ab.script
>
> Problem appears to be within FileLocator.getSearchPaths() not including the
> location that I have the resource
> ​ ​
> folder in my project (
> ​which does not conform to​
> a certain convention
> ​ that the method seems to be expecting​
> (
> ​which
>  was never mentioned in the ctakes documentation
> ​ so far as I could find​
> )). The
> ​ relevant​
> code snippet from the intellij
> ​debugging tool
> ​ for the FileLocator.class​
> when debugging
> ​ looks like:
>
> ------------------------------------------------------------
> -------------------------------
>
> private static Collection<String> getFileSearchPaths(String location) {
>     Collection<String> paths = new ArrayList();
>
>     // getting current working directory (I assume being registered as
> my toplevel intellij project location)
>
> String dir = System.getProperty("user.dir");
> if (dir != null && !dir.isEmpty()) {
> paths.add(dir + "/" + location);
> paths.add(dir + "/resources/" + location);
> }
>
> String cTakesHome = System.getenv("CTAKES_HOME");
> if (cTakesHome != null && !cTakesHome.isEmpty()) {
> paths.add(cTakesHome + "/" + location);
> paths.add(cTakesHome + "/resources/" + location);
> }
>
> if (dir != null && !dir.isEmpty()) {
> File ancestor = new File(dir);
>
>         // then starting from the parent folder of the CWD...
>
> while(ancestor.getParentFile() != null) {
> ancestor = ancestor.getParentFile();
>
>             // ...recursively building back down into each "child"
> folder to form a list of possible paths following the conventions
> shown here
>
> paths.add(ancestor + "/" + location);
> paths.add(ancestor + "/ctakes/" + location);
> paths.add(ancestor + "/resources/" + location);
> }
> }
>
> return paths;
> }
>
> ------------------------------------------------------------
> -------------------------------
> ​
>
> ​Examining the "paths" variable before the function returns, I see that it
> expects a certain absolute path convention (when the CTAKES_HOME env.
> variable is not explicitly set).
>
>
> Solution seemes to be to move the resources/ folder to one of the locations
> that the ctakes-core FileLocator.class
> is expecting it to be.
> ​My previous project structure looked like:
>
> ​$HOME/
> ​    project/
>         play-space/
>             /resouces ("marked as" resource root in intellij)
>             /desc (still don't know if I even need this, so please let me
> know)
>             /src
>                 <my java files>
>
> ​changing this to
>
> ​$HOME/
> ​    project/
>         play-space/
>             /src
>                 <my java files>
>     /resouces ("marked as" resource root in intellij)
>     /desc (still don't know if I even need this, so please let me know)
>
> seems to have fixed that issue. If there is anything else I should know
> related to this issue that is not explicitly documented in the ctakes docs,
> please let me know.
>
>
>
>
> On Wed, Apr 4, 2018 at 1:00 PM, Reed Villanueva <vi...@gmail.com>
> wrote:
>
> > As the title states, I am having trouble understanding where to place the
> > /resources (and /desc ?) folders in an intellij IDEA project that is
> trying
> > to use ctakes (don't work with java often).
> >
> > *TLDR: In intellij, how do I use the resources/ and des/ folders that
> come
> > in ctakes binary distributions? What is going on under the surface that
> > lets these things be recognized and used (even when outside of
> intellij)?*
> >
> > Currently I have added the jars by copying them to some folder and
> > pointing intellij to that folder as a library in the File --> Project
> > Structure. The way I am using the resources/ folder right now is by
> having
> > it in the same folder as a src folder in the intellij project ("marked
> as"
> > as "source" folder) and using the context menu on this resources/ copy to
> > "mark as" a "resource root".
> >
> > Testing with a simple variation of the HelloWorldAggregatePipeline.java
> > that can be found in the ctakes trunk/ctakes-examples/..., the code seems
> > to run, but I see errors like:
> >
> > ** Configuration Error: file:$PROJECT_HOME/project/
> >> out/production/project/org/apache/ctakes/lvg/data/config/lvg.properties
> >> (No such file or directory)
> >> ** Error: problem of opening/reading config file: 'file:$PROJECT_HOME
> >> /project/out/production/project/org/apache/ctakes/lvg/
> data/config/lvg.properties'.
> >> Use -x option to specify the config file path.
> >> ** Configuration Error: file:$PROJECT_HOME/project/
> >> out/production/project/org/apache/ctakes/lvg/data/config/lvg.properties
> >> (No such file or directory)
> >> ** Error: problem of opening/reading config file: 'file:$PROJECT_HOME
> >> /project/out/production/project/org/apache/ctakes/lvg/
> data/config/lvg.properties'.
> >> Use -x option to specify the config file path.
> >
> >
> > even though, checking in that location of the project, properties is
> > clearly there and I can open it and see its contents.
> >
> > This makes me suspect that I have not added them to the project
> correctly,
> > so what should be done? Thanks for advice.
> >
>

Re: How to add /desc and /resources to intellij IDEA project? [EXTERNAL]

Posted by Reed Villanueva <vi...@gmail.com>.
I see, thanks.
So you're saying that I would do something like: add the option
"-LookupXml=$HOME/project/org/apache/ctakes/dictionary/lookup/fast/sno_rx_16ab.xml"
to the VM options in the run configurations for my intellij project? Can
this be a comma-seperated list of locations?

On Fri, Apr 6, 2018 at 9:32 AM, Finan, Sean <
Sean.Finan@childrens.harvard.edu> wrote:

> Hi Reed,
>
> Wow, you went through a lot of trouble.  There actually is a much simpler
> solution.  It does need proper documentation as it is only hinted at in [1]
> and [2].  You can put a dictionary anywhere you want.  Then either in your
> piper file (configures pipeline) or the command line, or in the submitter
> gui [3], specify the LookupXml file location.   That xml file is what
> points to the dictionary database and specifies how it should be used.
>
> The best "how-to" is on the ctakes 4.0 wiki front page, the
> "pamphlet/manual" under Documentation. [4]
>
> Sean
>
> 1.
> https://cwiki.apache.org/confluence/display/CTAKES/Piper+Files
> 2.
> https://cwiki.apache.org/confluence/display/CTAKES/Dictionary+Creator+GUI
> 3.
> https://cwiki.apache.org/confluence/display/CTAKES/
> Piper+File+Submitter+GUI
> 4.
> https://cwiki.apache.org/confluence/display/CTAKES/cTAKES+4.0
>
>
>
> ________________________________________
> From: Reed Villanueva <vi...@gmail.com>
> Sent: Friday, April 6, 2018 3:16 PM
> To: dev@ctakes.apache.org
> Subject: Re: How to add /desc and /resources to intellij IDEA project?
> [EXTERNAL]
>
> ​​
> Fixed problem.
>
> Running similar program in the ctakes source trunk/examples...,
> ​I see that ​
> FileLocator.getResource() method should be using
> location=resources/org/apache/ctakes/dictionary/lookup/fast/
> sno_rx_16ab/sno_rx_16ab.script
> url=file:/home/
> ​me
> /projects/ctakes/trunk/resources/org/apache/ctakes/
> dictionary/lookup/fast/sno_rx_16ab/sno_rx_16ab.script
>
> Problem appears to be within FileLocator.getSearchPaths() not including the
> location that I have the resource
> ​ ​
> folder in my project (
> ​which does not conform to​
> a certain convention
> ​ that the method seems to be expecting​
> (
> ​which
>  was never mentioned in the ctakes documentation
> ​ so far as I could find​
> )). The
> ​ relevant​
> code snippet from the intellij
> ​debugging tool
> ​ for the FileLocator.class​
> when debugging
> ​ looks like:
>
> ------------------------------------------------------------
> -------------------------------
>
> private static Collection<String> getFileSearchPaths(String location) {
>     Collection<String> paths = new ArrayList();
>
>     // getting current working directory (I assume being registered as
> my toplevel intellij project location)
>
> String dir = System.getProperty("user.dir");
> if (dir != null && !dir.isEmpty()) {
> paths.add(dir + "/" + location);
> paths.add(dir + "/resources/" + location);
> }
>
> String cTakesHome = System.getenv("CTAKES_HOME");
> if (cTakesHome != null && !cTakesHome.isEmpty()) {
> paths.add(cTakesHome + "/" + location);
> paths.add(cTakesHome + "/resources/" + location);
> }
>
> if (dir != null && !dir.isEmpty()) {
> File ancestor = new File(dir);
>
>         // then starting from the parent folder of the CWD...
>
> while(ancestor.getParentFile() != null) {
> ancestor = ancestor.getParentFile();
>
>             // ...recursively building back down into each "child"
> folder to form a list of possible paths following the conventions
> shown here
>
> paths.add(ancestor + "/" + location);
> paths.add(ancestor + "/ctakes/" + location);
> paths.add(ancestor + "/resources/" + location);
> }
> }
>
> return paths;
> }
>
> ------------------------------------------------------------
> -------------------------------
> ​
>
> ​Examining the "paths" variable before the function returns, I see that it
> expects a certain absolute path convention (when the CTAKES_HOME env.
> variable is not explicitly set).
>
>
> Solution seemes to be to move the resources/ folder to one of the locations
> that the ctakes-core FileLocator.class
> is expecting it to be.
> ​My previous project structure looked like:
>
> ​$HOME/
> ​    project/
>         play-space/
>             /resouces ("marked as" resource root in intellij)
>             /desc (still don't know if I even need this, so please let me
> know)
>             /src
>                 <my java files>
>
> ​changing this to
>
> ​$HOME/
> ​    project/
>         play-space/
>             /src
>                 <my java files>
>     /resouces ("marked as" resource root in intellij)
>     /desc (still don't know if I even need this, so please let me know)
>
> seems to have fixed that issue. If there is anything else I should know
> related to this issue that is not explicitly documented in the ctakes docs,
> please let me know.
>
>
>
>
> On Wed, Apr 4, 2018 at 1:00 PM, Reed Villanueva <vi...@gmail.com>
> wrote:
>
> > As the title states, I am having trouble understanding where to place the
> > /resources (and /desc ?) folders in an intellij IDEA project that is
> trying
> > to use ctakes (don't work with java often).
> >
> > *TLDR: In intellij, how do I use the resources/ and des/ folders that
> come
> > in ctakes binary distributions? What is going on under the surface that
> > lets these things be recognized and used (even when outside of
> intellij)?*
> >
> > Currently I have added the jars by copying them to some folder and
> > pointing intellij to that folder as a library in the File --> Project
> > Structure. The way I am using the resources/ folder right now is by
> having
> > it in the same folder as a src folder in the intellij project ("marked
> as"
> > as "source" folder) and using the context menu on this resources/ copy to
> > "mark as" a "resource root".
> >
> > Testing with a simple variation of the HelloWorldAggregatePipeline.java
> > that can be found in the ctakes trunk/ctakes-examples/..., the code seems
> > to run, but I see errors like:
> >
> > ** Configuration Error: file:$PROJECT_HOME/project/
> >> out/production/project/org/apache/ctakes/lvg/data/config/lvg.properties
> >> (No such file or directory)
> >> ** Error: problem of opening/reading config file: 'file:$PROJECT_HOME
> >> /project/out/production/project/org/apache/ctakes/lvg/
> data/config/lvg.properties'.
> >> Use -x option to specify the config file path.
> >> ** Configuration Error: file:$PROJECT_HOME/project/
> >> out/production/project/org/apache/ctakes/lvg/data/config/lvg.properties
> >> (No such file or directory)
> >> ** Error: problem of opening/reading config file: 'file:$PROJECT_HOME
> >> /project/out/production/project/org/apache/ctakes/lvg/
> data/config/lvg.properties'.
> >> Use -x option to specify the config file path.
> >
> >
> > even though, checking in that location of the project, properties is
> > clearly there and I can open it and see its contents.
> >
> > This makes me suspect that I have not added them to the project
> correctly,
> > so what should be done? Thanks for advice.
> >
>

Re: How to add /desc and /resources to intellij IDEA project? [EXTERNAL]

Posted by "Finan, Sean" <Se...@childrens.harvard.edu>.
Hi Reed,

Wow, you went through a lot of trouble.  There actually is a much simpler solution.  It does need proper documentation as it is only hinted at in [1] and [2].  You can put a dictionary anywhere you want.  Then either in your piper file (configures pipeline) or the command line, or in the submitter gui [3], specify the LookupXml file location.   That xml file is what points to the dictionary database and specifies how it should be used.

The best "how-to" is on the ctakes 4.0 wiki front page, the "pamphlet/manual" under Documentation. [4]

Sean

1.
https://cwiki.apache.org/confluence/display/CTAKES/Piper+Files
2.
https://cwiki.apache.org/confluence/display/CTAKES/Dictionary+Creator+GUI
3.
https://cwiki.apache.org/confluence/display/CTAKES/Piper+File+Submitter+GUI
4.
https://cwiki.apache.org/confluence/display/CTAKES/cTAKES+4.0



________________________________________
From: Reed Villanueva <vi...@gmail.com>
Sent: Friday, April 6, 2018 3:16 PM
To: dev@ctakes.apache.org
Subject: Re: How to add /desc and /resources to intellij IDEA project? [EXTERNAL]

​​
Fixed problem.

Running similar program in the ctakes source trunk/examples...,
​I see that ​
FileLocator.getResource() method should be using
location=resources/org/apache/ctakes/dictionary/lookup/fast/sno_rx_16ab/sno_rx_16ab.script
url=file:/home/
​me
/projects/ctakes/trunk/resources/org/apache/ctakes/dictionary/lookup/fast/sno_rx_16ab/sno_rx_16ab.script

Problem appears to be within FileLocator.getSearchPaths() not including the
location that I have the resource
​ ​
folder in my project (
​which does not conform to​
a certain convention
​ that the method seems to be expecting​
(
​which
 was never mentioned in the ctakes documentation
​ so far as I could find​
)). The
​ relevant​
code snippet from the intellij
​debugging tool
​ for the FileLocator.class​
when debugging
​ looks like:

-------------------------------------------------------------------------------------------

private static Collection<String> getFileSearchPaths(String location) {
    Collection<String> paths = new ArrayList();

    // getting current working directory (I assume being registered as
my toplevel intellij project location)

String dir = System.getProperty("user.dir");
if (dir != null && !dir.isEmpty()) {
paths.add(dir + "/" + location);
paths.add(dir + "/resources/" + location);
}

String cTakesHome = System.getenv("CTAKES_HOME");
if (cTakesHome != null && !cTakesHome.isEmpty()) {
paths.add(cTakesHome + "/" + location);
paths.add(cTakesHome + "/resources/" + location);
}

if (dir != null && !dir.isEmpty()) {
File ancestor = new File(dir);

        // then starting from the parent folder of the CWD...

while(ancestor.getParentFile() != null) {
ancestor = ancestor.getParentFile();

            // ...recursively building back down into each "child"
folder to form a list of possible paths following the conventions
shown here

paths.add(ancestor + "/" + location);
paths.add(ancestor + "/ctakes/" + location);
paths.add(ancestor + "/resources/" + location);
}
}

return paths;
}

-------------------------------------------------------------------------------------------
​

​Examining the "paths" variable before the function returns, I see that it
expects a certain absolute path convention (when the CTAKES_HOME env.
variable is not explicitly set).


Solution seemes to be to move the resources/ folder to one of the locations
that the ctakes-core FileLocator.class
is expecting it to be.
​My previous project structure looked like:

​$HOME/
​    project/
        play-space/
            /resouces ("marked as" resource root in intellij)
            /desc (still don't know if I even need this, so please let me
know)
            /src
                <my java files>

​changing this to

​$HOME/
​    project/
        play-space/
            /src
                <my java files>
    /resouces ("marked as" resource root in intellij)
    /desc (still don't know if I even need this, so please let me know)

seems to have fixed that issue. If there is anything else I should know
related to this issue that is not explicitly documented in the ctakes docs,
please let me know.




On Wed, Apr 4, 2018 at 1:00 PM, Reed Villanueva <vi...@gmail.com>
wrote:

> As the title states, I am having trouble understanding where to place the
> /resources (and /desc ?) folders in an intellij IDEA project that is trying
> to use ctakes (don't work with java often).
>
> *TLDR: In intellij, how do I use the resources/ and des/ folders that come
> in ctakes binary distributions? What is going on under the surface that
> lets these things be recognized and used (even when outside of intellij)?*
>
> Currently I have added the jars by copying them to some folder and
> pointing intellij to that folder as a library in the File --> Project
> Structure. The way I am using the resources/ folder right now is by having
> it in the same folder as a src folder in the intellij project ("marked as"
> as "source" folder) and using the context menu on this resources/ copy to
> "mark as" a "resource root".
>
> Testing with a simple variation of the HelloWorldAggregatePipeline.java
> that can be found in the ctakes trunk/ctakes-examples/..., the code seems
> to run, but I see errors like:
>
> ** Configuration Error: file:$PROJECT_HOME/project/
>> out/production/project/org/apache/ctakes/lvg/data/config/lvg.properties
>> (No such file or directory)
>> ** Error: problem of opening/reading config file: 'file:$PROJECT_HOME
>> /project/out/production/project/org/apache/ctakes/lvg/data/config/lvg.properties'.
>> Use -x option to specify the config file path.
>> ** Configuration Error: file:$PROJECT_HOME/project/
>> out/production/project/org/apache/ctakes/lvg/data/config/lvg.properties
>> (No such file or directory)
>> ** Error: problem of opening/reading config file: 'file:$PROJECT_HOME
>> /project/out/production/project/org/apache/ctakes/lvg/data/config/lvg.properties'.
>> Use -x option to specify the config file path.
>
>
> even though, checking in that location of the project, properties is
> clearly there and I can open it and see its contents.
>
> This makes me suspect that I have not added them to the project correctly,
> so what should be done? Thanks for advice.
>

Re: How to add /desc and /resources to intellij IDEA project?

Posted by Reed Villanueva <vi...@gmail.com>.
​​
Fixed problem.

Running similar program in the ctakes source trunk/examples...,
​I see that ​
FileLocator.getResource() method should be using
location=resources/org/apache/ctakes/dictionary/lookup/fast/sno_rx_16ab/sno_rx_16ab.script
url=file:/home/
​me
/projects/ctakes/trunk/resources/org/apache/ctakes/dictionary/lookup/fast/sno_rx_16ab/sno_rx_16ab.script

Problem appears to be within FileLocator.getSearchPaths() not including the
location that I have the resource
​ ​
folder in my project (
​which does not conform to​
a certain convention
​ that the method seems to be expecting​
(
​which
 was never mentioned in the ctakes documentation
​ so far as I could find​
)). The
​ relevant​
code snippet from the intellij
​debugging tool
​ for the FileLocator.class​
when debugging
​ looks like:

-------------------------------------------------------------------------------------------

private static Collection<String> getFileSearchPaths(String location) {
    Collection<String> paths = new ArrayList();

    // getting current working directory (I assume being registered as
my toplevel intellij project location)

String dir = System.getProperty("user.dir");
if (dir != null && !dir.isEmpty()) {
paths.add(dir + "/" + location);
paths.add(dir + "/resources/" + location);
}

String cTakesHome = System.getenv("CTAKES_HOME");
if (cTakesHome != null && !cTakesHome.isEmpty()) {
paths.add(cTakesHome + "/" + location);
paths.add(cTakesHome + "/resources/" + location);
}

if (dir != null && !dir.isEmpty()) {
File ancestor = new File(dir);

        // then starting from the parent folder of the CWD...

while(ancestor.getParentFile() != null) {
ancestor = ancestor.getParentFile();

            // ...recursively building back down into each "child"
folder to form a list of possible paths following the conventions
shown here

paths.add(ancestor + "/" + location);
paths.add(ancestor + "/ctakes/" + location);
paths.add(ancestor + "/resources/" + location);
}
}

return paths;
}

-------------------------------------------------------------------------------------------
​

​Examining the "paths" variable before the function returns, I see that it
expects a certain absolute path convention (when the CTAKES_HOME env.
variable is not explicitly set).


Solution seemes to be to move the resources/ folder to one of the locations
that the ctakes-core FileLocator.class
is expecting it to be.
​My previous project structure looked like:

​$HOME/
​    project/
        play-space/
            /resouces ("marked as" resource root in intellij)
            /desc (still don't know if I even need this, so please let me
know)
            /src
                <my java files>

​changing this to

​$HOME/
​    project/
        play-space/
            /src
                <my java files>
    /resouces ("marked as" resource root in intellij)
    /desc (still don't know if I even need this, so please let me know)

seems to have fixed that issue. If there is anything else I should know
related to this issue that is not explicitly documented in the ctakes docs,
please let me know.




On Wed, Apr 4, 2018 at 1:00 PM, Reed Villanueva <vi...@gmail.com>
wrote:

> As the title states, I am having trouble understanding where to place the
> /resources (and /desc ?) folders in an intellij IDEA project that is trying
> to use ctakes (don't work with java often).
>
> *TLDR: In intellij, how do I use the resources/ and des/ folders that come
> in ctakes binary distributions? What is going on under the surface that
> lets these things be recognized and used (even when outside of intellij)?*
>
> Currently I have added the jars by copying them to some folder and
> pointing intellij to that folder as a library in the File --> Project
> Structure. The way I am using the resources/ folder right now is by having
> it in the same folder as a src folder in the intellij project ("marked as"
> as "source" folder) and using the context menu on this resources/ copy to
> "mark as" a "resource root".
>
> Testing with a simple variation of the HelloWorldAggregatePipeline.java
> that can be found in the ctakes trunk/ctakes-examples/..., the code seems
> to run, but I see errors like:
>
> ** Configuration Error: file:$PROJECT_HOME/project/
>> out/production/project/org/apache/ctakes/lvg/data/config/lvg.properties
>> (No such file or directory)
>> ** Error: problem of opening/reading config file: 'file:$PROJECT_HOME
>> /project/out/production/project/org/apache/ctakes/lvg/data/config/lvg.properties'.
>> Use -x option to specify the config file path.
>> ** Configuration Error: file:$PROJECT_HOME/project/
>> out/production/project/org/apache/ctakes/lvg/data/config/lvg.properties
>> (No such file or directory)
>> ** Error: problem of opening/reading config file: 'file:$PROJECT_HOME
>> /project/out/production/project/org/apache/ctakes/lvg/data/config/lvg.properties'.
>> Use -x option to specify the config file path.
>
>
> even though, checking in that location of the project, properties is
> clearly there and I can open it and see its contents.
>
> This makes me suspect that I have not added them to the project correctly,
> so what should be done? Thanks for advice.
>