[basex-talk] XQuery IntelliJ Plugin (was: Re: Programmatically extracting function signatures)

2018-11-06 Thread Reece Dunn
On Wed, 7 Nov 2018 at 01:27, Bridger Dyson-Smith 
wrote:

> Hi Christian -
>
> thank you for your work on the xqdoc files (and the link to the xquery
> used for generating them)!
>
> The current state of XQuery plugins for the JetBrains/IntelliJ IDEs has
> changed a bit since I added the IDEA documentation to the wiki. Grzegorz
> Ligas' XQuery Support plugin has been forked by the talented developers at
> OverStory, with lots of MarkLogic-specific features added. Reece Dunn also
> has been working on an XQuery plugin that takes a slightly different
> approach: rather than focusing on one implementation, Reece is working on a
> plugin that provides broader language support.
>

To add some background... My plugin started as an attempt to address
various issues in the XQuery parser in Grzegorz' plugin. [1] was the point
where I decided to attempt creating my own plugin, after reporting various
issues to Grzegorz. Specifically, my plugin aimed to:
1.  Address the keyword vs identifier issue in various places [2].
2.  Provide a robust lexer and parser with error recovery.
3.  Provide full support for the MarkLogic syntax in addition to XQuery 3
support -- this later evolved into adding support for other XQuery
extensions (updating, full text, scripting), XQuery 3.1 support, and BaseX
and Saxon vendor extension support.

Version 1.2 of my plugin has support for the BaseX update, fuzzy, and
non-deterministic extensions. Version 1.3 (in development) adds support for
the BaseX 9.1 ternary if, elvis operator, and if without else syntax
extensions. My plan is to publish 1.3 when the IntelliJ 2018.3 release
candidate is released, so the plugin is available for the full release.

My plugin does not currently support running queries, debugging, code
reformatting, auto-completion, and various other features that Grzegorz'
plugin supports. These are planned (I am currently working on running
queries), but these things take time. I've also been improving function
lookup in 1.3 to be standards conformant -- this is complex, and is not
100% complete. The technical challenges in implementing XQuery support in
an IDE are different to those implementing it in a query processor as it
needs to support the functionality and capabiilties of both the IDE and
XQuery.

My long-term plans are to implement as many of the XPath and XQuery static
errors from the error condition list as possible to spot all statically
determinable errors in the IDE, as well as various other inspections.

I'm also considering adding specific support for the XPath subset of XQuery
and integrating that with XSLT for better XPath support in IntelliJ.

The very minor work that I've done has been for Reece - I'm (slowly) adding
> implementation builtin function signatures that will be used by his plugin
> to provide improved static analysis.
>

My plans have always been to describe the built-in functions and static
context as XQuery files. I completed this for the XQuery and MarkLogic
functions, and Bridger has added BaseX, EXPath/EXQuery, and Saxon built-in
function definitions. In the future, I want to add complete API
descriptions using xqdoc comments so I can integrate them into the IDE when
my plugin supports displaying the xqdoc information in place. I also want
to use the information in the function annotations to report functions that
require a different version of the XQuery processor.

[1] https://github.com/ligasgr/intellij-xquery/issues/199
[2] I have solved this by making the NCName and keyword tokens implement a
common interface, then check for that interface when looking for NCNames. I
then remove the keyword styling on keywords in NCName positions after the
code has been parsed. I also use this to support the reserved function name
functionality.

Kind regards,
Reece

I hope that provides a bit of information regarding news with
> XQuery/JetBrains plugins.
> Best,
> Bridger
>
>
>
> On Tue, Oct 30, 2018 at 9:13 AM Christian Grün 
> wrote:
>
>> Hi Bridger,
>>
>> I am glad to report I have created new stub files for the BaseX XQuery
>> Modules [1]. They’ll now be included in the official releases again
>> [2]. I have also uploaded the script that I wrote for generating the
>> xqdoc output [3]. It’s far from perfect, but definitely more complete
>> than the old version. If you encounter any errors, please don’t
>> hesitate to tell me.
>>
>> Could you give us a little update on your contribution to the IntelliJ
>> XQuery plugin?
>>
>> Cheers,
>> Christian
>>
>> [1] https://github.com/BaseXdb/basex/issues/1623
>> [2] http://files.basex.org/releases/latest/
>> [3] https://github.com/BaseXdb/basex-dist/blob/master/wiki2xqdoc.xq
>>
>>
>>
>> On Mon, Sep 17, 2018 at 5:38 PM Bridger Dyson-Smith
>>  wrote:
>> >
>> > Hi all -
>> >
>> > I was curious if there was a way to extract function signatures from
>> BaseX. I'm currently reading through the (excellent) wiki but was curious
>> if there was a more automated process I might be able to use. I've been
>> 

Re: [basex-talk] Programmatically extracting function signatures

2018-11-06 Thread Bridger Dyson-Smith
Hi Christian -

thank you for your work on the xqdoc files (and the link to the xquery used
for generating them)!

The current state of XQuery plugins for the JetBrains/IntelliJ IDEs has
changed a bit since I added the IDEA documentation to the wiki. Grzegorz
Ligas' XQuery Support plugin has been forked by the talented developers at
OverStory, with lots of MarkLogic-specific features added. Reece Dunn also
has been working on an XQuery plugin that takes a slightly different
approach: rather than focusing on one implementation, Reece is working on a
plugin that provides broader language support. The very minor work that
I've done has been for Reece - I'm (slowly) adding implementation builtin
function signatures that will be used by his plugin to provide improved
static analysis.

I hope that provides a bit of information regarding news with
XQuery/JetBrains plugins.
Best,
Bridger



On Tue, Oct 30, 2018 at 9:13 AM Christian Grün 
wrote:

> Hi Bridger,
>
> I am glad to report I have created new stub files for the BaseX XQuery
> Modules [1]. They’ll now be included in the official releases again
> [2]. I have also uploaded the script that I wrote for generating the
> xqdoc output [3]. It’s far from perfect, but definitely more complete
> than the old version. If you encounter any errors, please don’t
> hesitate to tell me.
>
> Could you give us a little update on your contribution to the IntelliJ
> XQuery plugin?
>
> Cheers,
> Christian
>
> [1] https://github.com/BaseXdb/basex/issues/1623
> [2] http://files.basex.org/releases/latest/
> [3] https://github.com/BaseXdb/basex-dist/blob/master/wiki2xqdoc.xq
>
>
>
> On Mon, Sep 17, 2018 at 5:38 PM Bridger Dyson-Smith
>  wrote:
> >
> > Hi all -
> >
> > I was curious if there was a way to extract function signatures from
> BaseX. I'm currently reading through the (excellent) wiki but was curious
> if there was a more automated process I might be able to use. I've been
> trying to think of something clever with function-lookup, but I can't seem
> to make it dynamic based on module namespace; e.g.
> >
> > ```
> > for $fun in function-lookup(xs:QName("archive:delete"), 1)
> > return
> >   $fun
> > ```
> >
> > I may just grab the wiki and parse it :), but I'm also interested in
> changes between versions of the processor.
> >
> > Any thoughts or suggestions would be greatly appreciated!
> > Best,
> > Bridger
>


[basex-talk] Maybe interesting to you, Christian (et al)?

2018-11-06 Thread Andreas Mixich
Hello Christian & Co.,

nothing BaseX related, and maybe totally uninteresting to you, but as it
seems, you put some major efforts into the full text search, it could be
one of those nerdy passions, where one is just hungry and wants more food
on the topic:

TRE: A Regex Engine with Approximate Matching /
http://ducktape.blot.im/tre-a-regex-engine-with-approximate-matching


-- 
Minden jót, all the best, Alles Gute,
Andreas Mixich


[basex-talk] BaseX 9.1 on Maven Repository?

2018-11-06 Thread Han (US), Paul P
Hello,

Do you when the latest BaseX 9.1 release will be available from Maven 
Repository (https://mvnrepository.com/artifact/org.basex/basex)?

Regards,
Paul


Re: [basex-talk] Support for XML with different file extension in GUI

2018-11-06 Thread Christian Grün
Hi Kevin,

I’ll probably add an editable list of XML suffixes to the GUI
preference dialog. This suffix list will then be considered in all GUI
operations that check for the file type (file dialogs; set query
context; highlighting; database creation; etc). I’ll give you an
update once this will be available.

Best,
Christian


On Mon, Nov 5, 2018 at 7:00 PM Kevin Cline  wrote:
>
> Hi Christian,
>
> In this case, I'm dealing with just a few different extensions used by
> various linguistic software. While it would solve my problem, I'm not
> sure how helpful it would be others to include them in the static
> suffix list. Something more general might be helpful for others.
>
> The extensions I'm working with are .fwdata, .flextext, .lift, and
> .lift-ranges. All are just XML files.
>
> Thanks,
>
> Kevin
>
> On Mon, Nov 5, 2018 at 11:43 AM Christian Grün
>  wrote:
> >
> > Hi Kevin,
> >
> > Do your files have a typical XML file suffix, or do you have all kinds
> > of suffixes that are usually not associated with XML data? In the
> > first case, we could easily extend our static suffix list; in the
> > latter case, I’ll think about some more alternatives.
> >
> > Best,
> > Christian
> >
> >
> >
> > On Mon, Nov 5, 2018 at 4:52 PM Kevin Cline  wrote:
> > >
> > > Hello,
> > >
> > > In the GUI, is there any way to set the query context to an XML file that 
> > > has an extension other than .xml ?
> > >
> > > Renaming the file works, obviously, but this isn't ideal, as the source 
> > > of the data exports to and imports from another extension.
> > >
> > > Also, is it possible to enable syntax highlighting for XML files without 
> > > changing the extension? I added the extension in 
> > > Options->Preferences->File Filter, but nothing changed.
> > >
> > > Thank you for your help.


Re: [basex-talk] rest run query binding problem

2018-11-06 Thread Maximilian Gärber
Yes, you are correct.

Same also applies to the index parameters...


Thank you.


Am Di., 6. Nov. 2018 um 15:48 Uhr schrieb Christian Grün
:
>
> Hi Max,
>
> I guess this is because CHOP is also a valid serialization parameter
> [1], so it won’t be assigned as variable anymore. Does it work if you
> rename it to something like S-CHOP?
>
> Cheers,
> Christian
>
> [1] http://docs.basex.org/wiki/REST#Parameters
>
>
>
>
> On Tue, Nov 6, 2018 at 3:04 PM Maximilian Gärber  wrote:
> >
> > Hello,
> >
> >
> > given the query file [1]  called by
> >
> > http://localhost:8984/rest?run=argon/create-database.xq=test-db=no=no=yes=yes=no
> >
> > I get the error:
> >
> > Stopped at ., 3/18:
> > [XPDY0002] No value assigned to $CHOP.
> >
> > When I change the value, e.g. to nono I get
> >
> > Invalid 'CHOP' value 'nono'; must be 'yes', 'no', or a boolean.
> >
> > Running on basex 9.1
> >
> >
> >
> > [1] create-database.xq
> >
> > (:~ New database name. :)
> > declare variable $DB as xs:string external;
> > declare variable $CHOP as xs:string external;
> > declare variable $FTINDEX as xs:string external;
> > declare variable $TEXTINDEX as xs:string external;
> > declare variable $ATTRINDEX as xs:string external;
> > declare variable $TOKENINDEX as xs:string external;
> >
> > let $exists := db:exists($DB)
> > let $meta := concat('~meta_', $DB)
> > let $history := concat('~history_', $DB)
> >
> > return if(not($exists)) then (
> > db:create($meta),
> > db:create($history),
> > db:create($DB, (), (), map { 'chop' : $CHOP , 'ftindex' : $FTINDEX
> > , 'textindex' : $TEXTINDEX , 'attrindex' : $ATTRINDEX , 'tokenindex' :
> > $TOKENINDEX })
> > ) else ()


Re: [basex-talk] Converting a Date

2018-11-06 Thread Ron Katriel
Perfect. As always appreciate the great support and quick turnaround!

Best,
Ron

> On Nov 6, 2018, at 3:56 AM, Christian Grün  wrote:
> 
> We are working on a web site, which will facilitate the management of
> new external modules for BaseX. Users are expected to be able to
> upload new modules, search for existing modules and install them in
> local BaseX instances with a few clicks. This module will definitely
> be a good candidate for this web site.
> 
> 
>> On Tue, Nov 6, 2018 at 1:35 AM Ron Katriel  wrote:
>> 
>> Hi Andy,
>> 
>> Thanks for the quick solution! I imported the new module and was able to use 
>> the new function as follows:
>> 
>> xs:date(dates:parseDate($trial/completion_date)//value/text()) <= 
>> fn:current-date()
>> 
>> I verified the correctness for ~300 dates and the logic appears solid (for 
>> the kind of dates discussed below).
>> 
>> Any chance this could find its way into a BaseX release?
>> 
>> Best,
>> Ron
>> 
>> On November 5, 2018 at 10:27:48 AM, Andy Bunce (bunce.a...@gmail.com) wrote:
>> 
>> Hi Ron,
>> 
>> I took a quick look at Joe's module and made the following changes:
>> 
>> Change datetime:format-date(..,"-MM-dd") to 
>> format-date(..,"[]-[MM]-[DD]")
>> Change xdt:dayTimeDuration("P1D") -> xs:dayTimeDuration
>> Change function in namespace local: to dates:
>> 
>> And saved as a gist [1]. Then in BaseX
>> 
>> import module namespace dates = 
>> "https://urldefense.proofpoint.com/v2/url?u=http-3A__xqdev.com_dateparser=DwIFaQ=fi2D4-9xMzmjyjREwHYlAw=44jDQvzmnB_-ovfO6Iusj0ItciJrcWMOQQwd2peEBBE=KSPrAMbuxlxJKbnir6BnBSJRDflEuHmbAsMCnMJLIxQ=sYD9W2J5UO3Yxx9kgSMF2kixR8dfnRNA4dr4aG8OCKY=;
>>  at 
>> "https://urldefense.proofpoint.com/v2/url?u=https-3A__gist.githubusercontent.com_apb2006_ee0effdd53ca80daf4f1b3e99794ed89_raw_7eedb8343c3cbf0e4ef0063be5af532e8bbfe485_date-2Dparser.xqm=DwIFaQ=fi2D4-9xMzmjyjREwHYlAw=44jDQvzmnB_-ovfO6Iusj0ItciJrcWMOQQwd2peEBBE=KSPrAMbuxlxJKbnir6BnBSJRDflEuHmbAsMCnMJLIxQ=F3LKDivtSE6HjYFHiydFoDkPc4QwuA9DxY7KGutDgFg=;;
>> 
>> dates:parseDate("March 2017")
>> 
>> Returns
>> 
>>  
>>2017-03-01
>>2017-03-31
>>  
>>  2017-03-01
>> 
>> 
>> Joe,
>> I think all these changes are compatible with eXist too? [2]
>> 
>> Hope this helps.
>> /Andy
>> 
>> [1] 
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__gist.github.com_apb2006_ee0effdd53ca80daf4f1b3e99794ed89=DwIFaQ=fi2D4-9xMzmjyjREwHYlAw=44jDQvzmnB_-ovfO6Iusj0ItciJrcWMOQQwd2peEBBE=KSPrAMbuxlxJKbnir6BnBSJRDflEuHmbAsMCnMJLIxQ=lk5it1IL8ohiUwEKO-i34hIoz_J5gErrAYCbIR4oRAE=
>> [2] 
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__sourceforge.net_p_exist_mailman_message_34988159_=DwIFaQ=fi2D4-9xMzmjyjREwHYlAw=44jDQvzmnB_-ovfO6Iusj0ItciJrcWMOQQwd2peEBBE=KSPrAMbuxlxJKbnir6BnBSJRDflEuHmbAsMCnMJLIxQ=3_TI_h72pN_xdioUzLeDu-876lz_H-YlgHDJr2MAIX0=
>> 
>>> On Mon, 5 Nov 2018 at 02:03, Ron Katriel  wrote:
>>> 
>>> Hi Joe,
>>> 
>>> Thanks for sharing that. I tried adapting your eXist port to BaseX and ran 
>>> into issues with namespaces. At this point I don’t have the time or 
>>> expertise to complete this but hopefully someone else will take up the 
>>> challenge.
>>> 
>>> Best,
>>> Ron
>>> 
>>> On November 3, 2018 at 12:19:49 AM, Joe Wicentowski (joe...@gmail.com) 
>>> wrote:
>>> 
>>> Hi Ron,
>>> 
>>> You might find Ryan Grimm's date-parser library module useful if you have a 
>>> larger range of date formats to handle:
>>> 
>>>  
>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_marklogic-2Dcommunity_commons_blob_master_dates_date-2Dparser.xqy=DwIFaQ=fi2D4-9xMzmjyjREwHYlAw=44jDQvzmnB_-ovfO6Iusj0ItciJrcWMOQQwd2peEBBE=KSPrAMbuxlxJKbnir6BnBSJRDflEuHmbAsMCnMJLIxQ=XB-U5gSL9q8fTpeMVvJHsZcYhEkmxKm5k3z12cmGBjk=
>>> 
>>> While it was written with some MarkLogic-specific code, I adapted it for 
>>> use with eXist (but haven't tested it with BaseX):
>>> 
>>>  
>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_HistoryAtState_twitter_blob_master_modules_date-2Dparser.xqm=DwIFaQ=fi2D4-9xMzmjyjREwHYlAw=44jDQvzmnB_-ovfO6Iusj0ItciJrcWMOQQwd2peEBBE=KSPrAMbuxlxJKbnir6BnBSJRDflEuHmbAsMCnMJLIxQ=EFaBAZHvFF1zuS5mpHuVISqqj_tn5jn1Nda_02EH3Yw=
>>> 
>>> Best,
>>> Joe
>>> 
 On Fri, Nov 2, 2018 at 6:48 PM Ron Katriel  wrote:
 
 Hi Christian,
 
 Much appreciated! I hardened the code (see below) since the dates (from 
 CT.gov) occasionally also have the day of the month (e.g., “March 21, 
 2014”). Currently the function is dropping the day in such cases but I 
 will look into capturing it in a future iteration.
 
 Best,
 Ron
 
 
 declare function local:to-date($string) {
  if (fn:matches($string, '[A-Za-z]+ [0-9]+') or fn:matches($string, 
 '[A-Za-z]+ [0-9]+, [0-9]+'))
  then
  let $m := index-of($MONTHS, substring-before($string, ' '))
  let $y := xs:integer(functx:substring-after-last($string, ' '))
  return xs:date(string-join(
(
  format-number($y, ''),
  format-number($m, 

[basex-talk] rest run query binding problem

2018-11-06 Thread Maximilian Gärber
Hello,


given the query file [1]  called by

http://localhost:8984/rest?run=argon/create-database.xq=test-db=no=no=yes=yes=no

I get the error:

Stopped at ., 3/18:
[XPDY0002] No value assigned to $CHOP.

When I change the value, e.g. to nono I get

Invalid 'CHOP' value 'nono'; must be 'yes', 'no', or a boolean.

Running on basex 9.1



[1] create-database.xq

(:~ New database name. :)
declare variable $DB as xs:string external;
declare variable $CHOP as xs:string external;
declare variable $FTINDEX as xs:string external;
declare variable $TEXTINDEX as xs:string external;
declare variable $ATTRINDEX as xs:string external;
declare variable $TOKENINDEX as xs:string external;

let $exists := db:exists($DB)
let $meta := concat('~meta_', $DB)
let $history := concat('~history_', $DB)

return if(not($exists)) then (
db:create($meta),
db:create($history),
db:create($DB, (), (), map { 'chop' : $CHOP , 'ftindex' : $FTINDEX
, 'textindex' : $TEXTINDEX , 'attrindex' : $ATTRINDEX , 'tokenindex' :
$TOKENINDEX })
) else ()


Re: [basex-talk] http-server error with version 9

2018-11-06 Thread Christian Grün
This is what I just did (with Windows, starting from my desktop directory):

wget http://files.basex.org/releases/9.1/BaseX91.zip
unzip BaseX91.zip
cd basex/bin
basexhttp

Attached below is what I get. It seems that doesn’t work on your
system? Which output do you get if you do exactly the same?

C:/Users/user/Desktop/basex/.basex: writing new configuration file.
[main] INFO org.eclipse.jetty.util.log - Logging initialized @436ms to
org.eclipse.jetty.util.log.Slf4jLog
BaseX 9.1 [HTTP Server]
[main] INFO org.eclipse.jetty.server.Server - jetty-9.4.12.v20180830;
built: 2018-08-30T13:59:14.071Z; git:
27208684755d94a92186989f695db2d7b21ebc51; jvm 11.0.1+13
[main] INFO org.eclipse.jetty.webapp.StandardDescriptorProcessor - NO
JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
[main] INFO org.eclipse.jetty.server.session - DefaultSessionIdManager
workerName=node0
[main] INFO org.eclipse.jetty.server.session - No SessionScavenger
set, using defaults
[main] INFO org.eclipse.jetty.server.session - node0 Scavenging every 66ms
Server was started (port: 1984).
[main] INFO org.eclipse.jetty.server.handler.ContextHandler - Started
o.e.j.w.WebAppContext@66982506{BaseX: The XML Database and XQuery
Processor,/,file:///C:/Users/user/Desktop/basex/webapp/,AVAILABLE}{C:/Users/user/Desktop/basex/webapp}
[main] INFO org.eclipse.jetty.server.AbstractConnector - Started
ServerConnector@821330f{HTTP/1.1,[http/1.1]}{0.0.0.0:8984}
[main] INFO org.eclipse.jetty.server.Server - Started @1138ms
HTTP Server was started (port: 8984).
HTTP Stop Server was started (port: 8985).





On Tue, Nov 6, 2018 at 12:01 PM Günter Dunz-Wolff
 wrote:
>
> Hi Christian,
>
> thanks for the quick response.
>
> The error I copied appeared with a fresh copy (9.1, same with 9.0 and 9.01). 
> With my older 8.6.7 I’ll get this:
>
> /Applications/basex/bin/basexhttp ; exit;
> gdw-imac:~ gdw$ /Applications/basex/bin/basexhttp ; exit;
> /Users/gdw/.basex: Unknown option 'IGNOREHOSTNAME'.
> /Users/gdw/.basex: writing new configuration file.
> BaseX 8.6.6 [HTTP Server]
> [main] INFO org.eclipse.jetty.server.Server - jetty-8.1.18.v20150929
> [main] INFO org.eclipse.jetty.webapp.StandardDescriptorProcessor - NO JSP 
> Support for /, did not find org.apache.jasper.servlet.JspServlet
> Server was started (port: 1984).
> [main] INFO org.eclipse.jetty.server.AbstractConnector - Started 
> SelectChannelConnector@0.0.0.0:8984
> HTTP Server was started (port: 8984).
> HTTP Stop Server was started (port: 8985).
>
>
>
> Am 06.11.2018 um 11:28 schrieb Christian Grün :
>
> Hi Günter,
>
> Did you update your XML files (jetty.xml, pom.xml)? If yes, can you
> successfully run an unmodified basexhttp instance if you download a
> fresh distribution of BaseX?
>
> Best,
> Christian
>
>
>
> On Tue, Nov 6, 2018 at 11:21 AM Günter Dunz-Wolff
>  wrote:
>
>
> Hi all,
>
> I’m trying to update to version 9 of basex. Everything is OK, but I’m not 
> able to run basexhttp. I’m getting the following message:
>
> /Users/gdw/Downloads/basex-2/bin/basexhttp ; exit;
> gdw-imac:~ gdw$ /Users/gdw/Downloads/basex-2/bin/basexhttp ; exit;
> /Users/gdw/.basex: writing new configuration file.
> [main] INFO org.eclipse.jetty.util.log - Logging initialized @370ms to 
> org.eclipse.jetty.util.log.Slf4jLog
> [main] WARN org.eclipse.jetty.xml.XmlConfiguration - Config error at  name="addConnector">
>   name="host"> default="0.0.0.0"/> name="org.basex.serverport" default="8984"/> name="maxIdleTime">6true name="Acceptors">265535
>
> org.eclipse.jetty.server.nio.SelectChannelConnector
> logout
> Saving session...
> ...copying shared history...
> ...saving history...truncating history files...
> ...completed.
>
> [Prozess beendet]
>
> All versions till 8.6.7 are running.
>
> My system is MacOS X Mojave.
> Java-Version is:
> java version "1.8.0_191"
> Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
> Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
>
> I hope, there is help.
>
> Thanks in advance. Guenter
>
>


Re: [basex-talk] http-server error with version 9

2018-11-06 Thread Günter Dunz-Wolff
Hi Christian,

thanks for the quick response.

The error I copied appeared with a fresh copy (9.1, same with 9.0 and 9.01). 
With my older 8.6.7 I’ll get this:

/Applications/basex/bin/basexhttp ; exit;
gdw-imac:~ gdw$ /Applications/basex/bin/basexhttp ; exit;
/Users/gdw/.basex: Unknown option 'IGNOREHOSTNAME'.
/Users/gdw/.basex: writing new configuration file.
BaseX 8.6.6 [HTTP Server]
[main] INFO org.eclipse.jetty.server.Server - jetty-8.1.18.v20150929
[main] INFO org.eclipse.jetty.webapp.StandardDescriptorProcessor - NO JSP 
Support for /, did not find org.apache.jasper.servlet.JspServlet
Server was started (port: 1984).
[main] INFO org.eclipse.jetty.server.AbstractConnector - Started 
SelectChannelConnector@0.0.0.0:8984
HTTP Server was started (port: 8984).
HTTP Stop Server was started (port: 8985).



> Am 06.11.2018 um 11:28 schrieb Christian Grün :
> 
> Hi Günter,
> 
> Did you update your XML files (jetty.xml, pom.xml)? If yes, can you
> successfully run an unmodified basexhttp instance if you download a
> fresh distribution of BaseX?
> 
> Best,
> Christian
> 
> 
> 
> On Tue, Nov 6, 2018 at 11:21 AM Günter Dunz-Wolff
>  wrote:
>> 
>> Hi all,
>> 
>> I’m trying to update to version 9 of basex. Everything is OK, but I’m not 
>> able to run basexhttp. I’m getting the following message:
>> 
>> /Users/gdw/Downloads/basex-2/bin/basexhttp ; exit;
>> gdw-imac:~ gdw$ /Users/gdw/Downloads/basex-2/bin/basexhttp ; exit;
>> /Users/gdw/.basex: writing new configuration file.
>> [main] INFO org.eclipse.jetty.util.log - Logging initialized @370ms to 
>> org.eclipse.jetty.util.log.Slf4jLog
>> [main] WARN org.eclipse.jetty.xml.XmlConfiguration - Config error at > name="addConnector">
>>  > name="host">> default="0.0.0.0"/>> name="org.basex.serverport" default="8984"/>> name="maxIdleTime">6true> name="Acceptors">265535
>>
>> org.eclipse.jetty.server.nio.SelectChannelConnector
>> logout
>> Saving session...
>> ...copying shared history...
>> ...saving history...truncating history files...
>> ...completed.
>> 
>> [Prozess beendet]
>> 
>> All versions till 8.6.7 are running.
>> 
>> My system is MacOS X Mojave.
>> Java-Version is:
>> java version "1.8.0_191"
>> Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
>> Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
>> 
>> I hope, there is help.
>> 
>> Thanks in advance. Guenter



Re: [basex-talk] http-server error with version 9

2018-11-06 Thread Christian Grün
Hi Günter,

Did you update your XML files (jetty.xml, pom.xml)? If yes, can you
successfully run an unmodified basexhttp instance if you download a
fresh distribution of BaseX?

Best,
Christian



On Tue, Nov 6, 2018 at 11:21 AM Günter Dunz-Wolff
 wrote:
>
> Hi all,
>
> I’m trying to update to version 9 of basex. Everything is OK, but I’m not 
> able to run basexhttp. I’m getting the following message:
>
> /Users/gdw/Downloads/basex-2/bin/basexhttp ; exit;
> gdw-imac:~ gdw$ /Users/gdw/Downloads/basex-2/bin/basexhttp ; exit;
> /Users/gdw/.basex: writing new configuration file.
> [main] INFO org.eclipse.jetty.util.log - Logging initialized @370ms to 
> org.eclipse.jetty.util.log.Slf4jLog
> [main] WARN org.eclipse.jetty.xml.XmlConfiguration - Config error at  name="addConnector">
>name="host"> default="0.0.0.0"/> name="org.basex.serverport" default="8984"/> name="maxIdleTime">6true name="Acceptors">265535
> 
> org.eclipse.jetty.server.nio.SelectChannelConnector
> logout
> Saving session...
> ...copying shared history...
> ...saving history...truncating history files...
> ...completed.
>
> [Prozess beendet]
>
> All versions till 8.6.7 are running.
>
> My system is MacOS X Mojave.
> Java-Version is:
> java version "1.8.0_191"
> Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
> Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
>
> I hope, there is help.
>
> Thanks in advance. Guenter


[basex-talk] http-server error with version 9

2018-11-06 Thread Günter Dunz-Wolff
Hi all,

I’m trying to update to version 9 of basex. Everything is OK, but I’m not able 
to run basexhttp. I’m getting the following message:

/Users/gdw/Downloads/basex-2/bin/basexhttp ; exit;
gdw-imac:~ gdw$ /Users/gdw/Downloads/basex-2/bin/basexhttp ; exit;
/Users/gdw/.basex: writing new configuration file.
[main] INFO org.eclipse.jetty.util.log - Logging initialized @370ms to 
org.eclipse.jetty.util.log.Slf4jLog
[main] WARN org.eclipse.jetty.xml.XmlConfiguration - Config error at 
  6true265535

org.eclipse.jetty.server.nio.SelectChannelConnector
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Prozess beendet]

All versions till 8.6.7 are running.

My system is MacOS X Mojave.
Java-Version is: 
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

I hope, there is help.

Thanks in advance. Guenter

Re: [basex-talk] Converting a Date

2018-11-06 Thread Christian Grün
We are working on a web site, which will facilitate the management of
new external modules for BaseX. Users are expected to be able to
upload new modules, search for existing modules and install them in
local BaseX instances with a few clicks. This module will definitely
be a good candidate for this web site.


On Tue, Nov 6, 2018 at 1:35 AM Ron Katriel  wrote:
>
> Hi Andy,
>
> Thanks for the quick solution! I imported the new module and was able to use 
> the new function as follows:
>
> xs:date(dates:parseDate($trial/completion_date)//value/text()) <= 
> fn:current-date()
>
> I verified the correctness for ~300 dates and the logic appears solid (for 
> the kind of dates discussed below).
>
> Any chance this could find its way into a BaseX release?
>
> Best,
> Ron
>
> On November 5, 2018 at 10:27:48 AM, Andy Bunce (bunce.a...@gmail.com) wrote:
>
> Hi Ron,
>
> I took a quick look at Joe's module and made the following changes:
>
> Change datetime:format-date(..,"-MM-dd") to 
> format-date(..,"[]-[MM]-[DD]")
> Change xdt:dayTimeDuration("P1D") -> xs:dayTimeDuration
> Change function in namespace local: to dates:
>
> And saved as a gist [1]. Then in BaseX
>
> import module namespace dates = "http://xqdev.com/dateparser; at 
> "https://gist.githubusercontent.com/apb2006/ee0effdd53ca80daf4f1b3e99794ed89/raw/7eedb8343c3cbf0e4ef0063be5af532e8bbfe485/date-parser.xqm;;
>
> dates:parseDate("March 2017")
>
> Returns
> 
>   
> 2017-03-01
> 2017-03-31
>   
>   2017-03-01
> 
>
> Joe,
> I think all these changes are compatible with eXist too? [2]
>
> Hope this helps.
> /Andy
>
> [1] https://gist.github.com/apb2006/ee0effdd53ca80daf4f1b3e99794ed89
> [2] https://sourceforge.net/p/exist/mailman/message/34988159/
>
> On Mon, 5 Nov 2018 at 02:03, Ron Katriel  wrote:
>>
>> Hi Joe,
>>
>> Thanks for sharing that. I tried adapting your eXist port to BaseX and ran 
>> into issues with namespaces. At this point I don’t have the time or 
>> expertise to complete this but hopefully someone else will take up the 
>> challenge.
>>
>> Best,
>> Ron
>>
>> On November 3, 2018 at 12:19:49 AM, Joe Wicentowski (joe...@gmail.com) wrote:
>>
>> Hi Ron,
>>
>> You might find Ryan Grimm's date-parser library module useful if you have a 
>> larger range of date formats to handle:
>>
>>   
>> https://github.com/marklogic-community/commons/blob/master/dates/date-parser.xqy
>>
>> While it was written with some MarkLogic-specific code, I adapted it for use 
>> with eXist (but haven't tested it with BaseX):
>>
>>   
>> https://github.com/HistoryAtState/twitter/blob/master/modules/date-parser.xqm
>>
>> Best,
>> Joe
>>
>> On Fri, Nov 2, 2018 at 6:48 PM Ron Katriel  wrote:
>>>
>>> Hi Christian,
>>>
>>> Much appreciated! I hardened the code (see below) since the dates (from 
>>> CT.gov) occasionally also have the day of the month (e.g., “March 21, 
>>> 2014”). Currently the function is dropping the day in such cases but I will 
>>> look into capturing it in a future iteration.
>>>
>>> Best,
>>> Ron
>>>
>>>
>>> declare function local:to-date($string) {
>>>   if (fn:matches($string, '[A-Za-z]+ [0-9]+') or fn:matches($string, 
>>> '[A-Za-z]+ [0-9]+, [0-9]+'))
>>>   then
>>>   let $m := index-of($MONTHS, substring-before($string, ' '))
>>>   let $y := xs:integer(functx:substring-after-last($string, ' '))
>>>   return xs:date(string-join(
>>> (
>>>   format-number($y, ''),
>>>   format-number($m, '00'),
>>>   '01'
>>> ),
>>> '-')
>>>   )
>>>   else
>>>   ()
>>> };
>>>
>>> On November 2, 2018 at 4:20:41 PM, Christian Grün 
>>> (christian.gr...@gmail.com) wrote:
>>>
>>> Hi Ron,
>>>
>>> If your timestamp is available in IETF format, you can use
>>> fn:parse-ietf-date [1]. Otherwise, you’ll need to write a simple
>>> function by yourself:
>>>
>>> declare variable $MONTHS := (
>>> 'January', 'February', 'March', 'April', 'May', 'June',
>>> 'July', 'August', 'September', 'October', 'November', 'December'
>>> );
>>>
>>> declare function local:to-date($string) {
>>> let $m := index-of($MONTHS, substring-before($string, ' '))
>>> let $y := xs:integer(substring-after($string, ' '))
>>> return xs:date(string-join((
>>> format-number($y, ''),
>>> format-number($m, '00'),
>>> '01'
>>> ), '-'))
>>> };
>>> local:to-date('March 2017')
>>>
>>> Best,
>>> Christian
>>>
>>> [1] 
>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__www.w3.org_TR_xpath-2Dfunctions-2D31_-23func-2Dparse-2Dietf-2Ddate=DwIFaQ=fi2D4-9xMzmjyjREwHYlAw=44jDQvzmnB_-ovfO6Iusj0ItciJrcWMOQQwd2peEBBE=Yy9sC1xS_Ix-pGSVDp-Lbmz8BOft0S1WdVpEM-qzRw4=uQ3NqCv8FpHulP4q1arjItJX3-gCHwi_06WN4znRz48=
>>>
>>>
>>>
>>> On Fri, Nov 2, 2018 at 9:09 PM Ron Katriel  wrote:
>>> >
>>> > Hi,
>>> >
>>> > Is there a BaseX function for converting a string date in the form of 
>>> > “March 2017” to xs:date or xs:dateTime?
>>> >
>>> > Thanks,
>>> > Ron