From wshager at gmail.com Mon Feb 1 04:14:27 2016 From: wshager at gmail.com (W.S. Hager) Date: Mon, 1 Feb 2016 13:14:27 +0100 Subject: [xquery-talk] Function for determining one XPath as subset of another In-Reply-To: <7D5E32FA-F00A-4A55-8B82-450BEC6A0BB6@gmail.com> References: <117C8FBF-A51A-4DE2-8655-77D614242088@gmail.com> <8F63EA56-D631-4CA8-9DB8-4E545BF5D8BE@saxonica.com> <59DB66C2-39D1-44E2-9E64-D83A4351BF24@gmail.com> <253CB5F3-FB51-4272-9E42-C3BAD54D0EA4@gmail.com> <7D5E32FA-F00A-4A55-8B82-450BEC6A0BB6@gmail.com> Message-ID: Like I mentioned, co-inductive types are used to deal with non-determinism in formal proofs, although I don't know enough about the subject to give an example. 2016-01-29 23:29 GMT+01:00 Pavel Velikhov : > Trees won?t help much here. The difficulty with path expression is due to > the // step, which adds non-determinism. > > //w/x subsumes /w/x/y/z/w/x > //w/w doesn?t subsume /w/x/w > > Regular languages also have determinism and all the algorithms for them > are exceptionally well-studied. > Or you can do an algorithm with backtracking, but it could get hairy. > > > On 29 Jan 2016, at 20:53, W.S. Hager wrote: > > This is the best I (actually Google) can do. > > Proof: > https://coq.inria.fr/library/Coq.MSets.MSetGenTree.html > > Test: > > > http://www.geeksforgeeks.org/check-if-a-binary-tree-is-subtree-of-another-binary-tree/ > > At some point I'll look into this myself, it's a nice challenge. > > donderdag 28 januari 2016 heeft Pavel Velikhov > het volgende geschreven: > >> Hmm.. testing subsumption is not as trivial as I thought. Here's a >> cleaner way to do it: represent both path expressions as DFAs and then test >> subsumption. You'll get DFAs A and B and then test if minimized(B-A) is >> empty. >> > > > -- > > W.S. Hager > Lagua Web Solutions > http://lagua.nl > > > -- W.S. Hager Lagua Web Solutions http://lagua.nl -------------- next part -------------- An HTML attachment was scrubbed... URL: From dflorescu at me.com Wed Feb 3 13:37:44 2016 From: dflorescu at me.com (daniela florescu) Date: Wed, 03 Feb 2016 13:37:44 -0800 Subject: [xquery-talk] Function for determining one XPath as subset of another In-Reply-To: <06E56710-99B8-4891-B890-057D1012E941@gmail.com> References: <117C8FBF-A51A-4DE2-8655-77D614242088@gmail.com> <8F63EA56-D631-4CA8-9DB8-4E545BF5D8BE@saxonica.com> <59DB66C2-39D1-44E2-9E64-D83A4351BF24@gmail.com> <253CB5F3-FB51-4272-9E42-C3BAD54D0EA4@gmail.com> <06E56710-99B8-4891-B890-057D1012E941@gmail.com> Message-ID: <64BF7EB3-4A4F-402B-A2DE-174ACC09E9EF@me.com> Adam, write me directly and I?ll give you an algorithm that guarantees sufficient conditions for subsumption, given a large enough subset of Path. Best Dana > On Jan 28, 2016, at 4:47 AM, Pavel Velikhov wrote: > > >> @Pavel do you mean the link I send before? http://www.w3.org/TR/xquery-semantics > Yes! That?s it. > >> What would be the difference between a proof and a test, in this case? > > Well, proving a specific case is usually very easy, assuming the proof isn?t too formal. > > A test is a general procedure. Shouldn?t be that hard, unless we try to prove its correctness > (and depending on how formal we want to proof to be). >> >> 2016-01-28 13:35 GMT+01:00 Adam Retter >: >> > So you need an algorithm to test subsumption of path expressions (with the given limitations)? >> >> Yes. >> >> > Or just that one case? >> >> No I want to cover any case where the set which would be selected by >> the path expression is statically known (i.e. no function calls). >> >> >> >> -- >> Adam Retter >> >> skype: adam.retter >> tweet: adamretter >> http://www.adamretter.org.uk >> >> >> >> -- >> W.S. Hager >> Lagua Web Solutions >> http://lagua.nl > -------------- next part -------------- An HTML attachment was scrubbed... URL: From benito at tcs.uni-luebeck.de Sun Feb 7 05:56:14 2016 From: benito at tcs.uni-luebeck.de (Benito van der Zander) Date: Sun, 07 Feb 2016 14:56:14 +0100 Subject: [xquery-talk] implementing format-* in XQuery 1 Message-ID: <56B74CFE.9060701@tcs.uni-luebeck.de> Hi, does anyone have an open-source implementation of XQuery 3's format-* functions using only the functions of XQuery 1? Googling it shows someone called Minollo posted something like that on xml-connection.com, but it is offline now. Who is Minollo? Best, Benito From christian.gruen at gmail.com Mon Feb 8 08:48:39 2016 From: christian.gruen at gmail.com (=?UTF-8?Q?Christian_Gr=C3=BCn?=) Date: Mon, 8 Feb 2016 17:48:39 +0100 Subject: [xquery-talk] [ANN] BaseX 8.4: The XML Prague 2016 Edition Message-ID: Dear all, Aligned with the XML Prague 2016 Conference, we are more than happy to provide you with a great new version of BaseX, your XML database system and XQuery processor! These are the new features: GUI - Project View: all modules of the project are now parsed in the background - Create Database, Properties: easy access to advanced database options - Sort Dialog: order by column positions and locale collation INDEXING - New Token Index: speedy token lookups in DITA and HTML documents - Including full support for incremental and main-memory databases - XQuery optimizations for fn:contains-token, fn:tokenize, fn:idref WEB APPLICATIONS - Cancel server-side queries via %rest:single annotation - DBA query editor: faster querying, better responsivity XQUERY - Database Module: ADDCACHE support (caching of large results) - Direct output of binary data with new 'basex' serialization method - Better XQuery 3.1 compliance: string constructors, new functions - Java bindings: address specific Java function signatures - User Module: create users and grant permissions in one step DOCUMENTATION - Many Wiki articles have been revised and updated A big thank you to our sponsors, which made some new features possible and available to everyone, and a special shout-out to Jens Erat, who realized the new token index! Visit http://basex.org to find the latest release. We are looking forward to your feedback, Christian BaseX Team From adam.retter at googlemail.com Sun Feb 21 11:57:16 2016 From: adam.retter at googlemail.com (Adam Retter) Date: Sun, 21 Feb 2016 19:57:16 +0000 Subject: [xquery-talk] Function for determining one XPath as subset of another In-Reply-To: References: <117C8FBF-A51A-4DE2-8655-77D614242088@gmail.com> <8F63EA56-D631-4CA8-9DB8-4E545BF5D8BE@saxonica.com> <59DB66C2-39D1-44E2-9E64-D83A4351BF24@gmail.com> Message-ID: Okay so for those that are interested, here is the solution that I ended up with: 1) I wrote my own XPath 2 parser as I wanted a simplified AST to start operating from. The project I am working on needs to be under GPL2 and I could not find a decent Java library that was compatible with that license - https://github.com/exquery/xpath2-parser/ 2) I then wrote some utility functions for descending through the Path expressions and making subset comparisons - https://github.com/adamretter/TEI-Completer/blob/master/src/main/java/org/humanistika/oxygen/tei/completer/XPathUtil.java#L79 Yes, this has many limitations and is most likely not complete yet, but it serves me well for the small subset of XPath path expressions that I want to support. 3) You can see in my test-cases how I consider one path expression as a subset of another path expression: https://github.com/adamretter/TEI-Completer/blob/master/src/test/java/org/humanistika/oxygen/tei/completer/XPathUtilTest.java#L40 Maybe that is of interest to some of you... Cheers On 28 January 2016 at 12:18, Adam Retter wrote: > Okay thanks to everyone for the replies. > > I think the scope of what I was looking for got thrown out in all the > discussion, or perhaps I wasn't clear enough early in my initial post. > > I am not interested in XQuery, and I am only interested in a small > subset of XPath. I am concerned with comparing two path expressions, > these path expressions may have predicates, what I didn't make clear > is that those predicates may not contain functions, only the > comparison operators eq, ne, gt, ge, lt, le, and =, !=, >, >=, <, <=. > > > As Christian observed, [1] is not the same as [@a eq 'b']. In my > original post, I posed these two path expressions: > > 1. //w > > 2. /x/y/z/w[@a = 'v'] > > In this instance I can actually ignore the predicate, as I can see > that /x/y/z/w would already produce the subset of //w and the > predicate only serves to restrict that further. > > I am not looking for a formal proof in any sense. I am looking for > something practical that I can use in code. > > > On 28 January 2016 at 09:55, Pavel Velikhov wrote: >> >> Finally, can it be proved that /w[@a=b] is a subset of /w, taking into >> account that the filter can only contain standard operators (eq, gt, lt, etc >> as defined in the op namespace)? >> >> >> Okay, now we are close! However now formal do you want the proof to be? I >> can give this informal proof: >> >> The first path expression selects some subset of the children of the node >> that it applies, where the label is 'w'. The second one selects all >> descendants with label 'w', hence it's result contains all nodes of the >> first path expression. >> >> But if you want to go formal, you need to use the semantics of XQuery path >> expressions, as well as the formal specification of the data model. There >> used to be a formal document on XQuery data model. >> >> >> >> 2016-01-27 17:46 GMT+01:00 Christian Gr?n : >>> >>> > Well, so, to continue, let's assume that there are no user-defined >>> > functions, and in fact the only thing we want to proof is select+filter, >>> > where a filter is limited to the default operators. From that is it >>> > follows >>> > that >>> > >>> > -path1: >>> > select-child-nodes-by-name(select-child-nodes-by-name($context,'x'),'w') >>> > -path2: select-descendant-nodes-by-name($context,'w') >>> >>> Just to complete this: The predicate must not be numeric (//w[1] is >>> not equivalent to /descendant::w[1]). >>> >>> >>> >>> > Op woensdag 27 januari 2016 heeft daniela florescu >>> > het >>> > volgende geschreven: >>> >> >>> >> > >>> >> > It seems to be a long-standing tradition that computer scientists, >>> >> > when >>> >> > asked to prove a difficult conjecture C, respond by giving a proof >>> >> > for a >>> >> > simplified conjecture C'. While this might lead to progress in the >>> >> > long run, >>> >> > and enables them to get papers published in the academic literature, >>> >> > it is >>> >> > totally useless to practical engineeers who want to know whether they >>> >> > can >>> >> > safely rely on C. >>> >> >>> >> Michael, >>> >> >>> >> >>> >> what you say is nice and true. >>> >> >>> >> However given that: >>> >> 1. path expressions point (syntactically hence esemantically) into >>> >> XQuery?s expressions >>> >> 2. XQuery expression language is Turing complete >>> >> 3. Subsumption for a Turing complete language is undecidable. >>> >> >>> >> Well, I can hardly see a way to decide this problem other then by >>> >> introducing SOME restrictions >>> >> of some sort? but of course some restrictions that would not nullify >>> >> the >>> >> original problem all together >>> >> and make the solution useless. >>> >> >>> >> Best, >>> >> Dana >>> > >>> > >>> > >>> > -- >>> > >>> > W.S. Hager >>> > Lagua Web Solutions >>> > http://lagua.nl >>> > >>> > >>> > >>> > _______________________________________________ >>> > talk at x-query.com >>> > http://x-query.com/mailman/listinfo/talk >> >> >> >> >> -- >> >> W.S. Hager >> Lagua Web Solutions >> http://lagua.nl > > > > -- > Adam Retter > > skype: adam.retter > tweet: adamretter > http://www.adamretter.org.uk -- Adam Retter skype: adam.retter tweet: adamretter http://www.adamretter.org.uk