Re: [basex-talk] Question regarding BaseX support for id and idref

2013-05-13 Thread James Wright
Hey Liam,
I really appreciate your time with this. That really clears everything up. 
Thanks again.- James

> Subject: Re: [basex-talk] Question regarding BaseX support for id and idref
> From: l...@w3.org
> To: james...@hotmail.com
> CC: basex-talk@mailman.uni-konstanz.de
> Date: Mon, 13 May 2013 23:53:54 -0400
> 
> On Mon, 2013-05-13 at 21:01 -0600, James Wright wrote:
> > Liam,
> > I think that answers my question and is what I expected. So basically
> > BaseX and maybe XQuery as a whole does not respect or understand the
> > id/idref concept formally and thus will not automatically join.
> 
> It's actually not strictly true - a DTD-aware XQuery processor can
> supply the id() and idref() XPath functions. However, these do not work
> across documents, and the values must be legal XML identifiers.
> 
> Having said that, most XML databases make indexes, so joins using FLWOR
> and values will work based on values.
> 
> Although there are no integrity constraints as such, you can use XML
> Schema to validate incoming data in some implementations automatically,
> and in others by running a validator as part of some external process.
> 
> > [...]
> 
> > I need to handle the relationship explicitly.
> 
> Yes.
> 
> Note also, by the way, that XML databases tend to go fastest when you
> have
> . few or zero XML namespaces
> . lots of different XML element names
> . content rather than attributes (as then you can use full text).
> 
> But this is only a general rule of thumb; like all database query
> languages you can sometimes write a query that takes milliseconds and
> sometimes you write one that takes days. Luckily XQuery has been around
> for a while and the surviving implementations generally do some pretty
> good optimization.
> 
> Liam
> 
> -- 
> Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
> Pictures from old books: http://fromoldbooks.org/
> Ankh: irc.sorcery.net irc.gnome.org freenode/#xml
> 
  ___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] Question regarding BaseX support for id and idref

2013-05-13 Thread Liam R E Quin
On Mon, 2013-05-13 at 21:01 -0600, James Wright wrote:
> Liam,
> I think that answers my question and is what I expected. So basically
> BaseX and maybe XQuery as a whole does not respect or understand the
> id/idref concept formally and thus will not automatically join.

It's actually not strictly true - a DTD-aware XQuery processor can
supply the id() and idref() XPath functions. However, these do not work
across documents, and the values must be legal XML identifiers.

Having said that, most XML databases make indexes, so joins using FLWOR
and values will work based on values.

Although there are no integrity constraints as such, you can use XML
Schema to validate incoming data in some implementations automatically,
and in others by running a validator as part of some external process.

> [...]

> I need to handle the relationship explicitly.

Yes.

Note also, by the way, that XML databases tend to go fastest when you
have
. few or zero XML namespaces
. lots of different XML element names
. content rather than attributes (as then you can use full text).

But this is only a general rule of thumb; like all database query
languages you can sometimes write a query that takes milliseconds and
sometimes you write one that takes days. Luckily XQuery has been around
for a while and the surviving implementations generally do some pretty
good optimization.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] Question regarding BaseX support for id and idref

2013-05-13 Thread James Wright
Liam,
I think that answers my question and is what I expected. So basically BaseX and 
maybe XQuery as a whole does not respect or understand the id/idref concept 
formally and thus will not automatically join. This isn't a 'problem' so much 
as an attempt to insure I do not reproduce what already exists. 
Does this sound correct? For example if I had a node named item with 2 child 
nodes simply referencing another childitem node by ID but not inline. 
with item as the context node. If I wrote:
childitem
I would expect the nodes being referenced not the inline nodes with the 
references on them. But this is not how it works.. Right? I need to handle the 
relationship explicitly.
- James

> Subject: Re: [basex-talk] Question regarding BaseX support for id and idref
> From: l...@w3.org
> To: james...@hotmail.com
> CC: basex-talk@mailman.uni-konstanz.de
> Date: Mon, 13 May 2013 21:36:34 -0400
> 
> On Mon, 2013-05-13 at 19:15 -0600, James Wright wrote:
> > [...] I know the xml standard defines id and idref however I have not
> > been able to find any documentation on these in BaseX or XML in
> > general. For example does BaseX handle idiosyncrasies of id and idref
> > or must I handle these in my queries? For example:
> > let $context := 
> 
> Note that an XML ID must be an identifier, so must start with a name
> start character (a letter)...
> 
> > let $context := 
> >  
> > 
> > 
> > for $itemWithFirstChild in $context/item[child/@name = 'firstChild']return 
> > $itemWithFirstChild/@id
> 
> I think this got garbled somewhere - e.g. there aren't enough end tags.
> Make sure you turn off HTML formatting in your email program.
> 
> > I would like this to return "10 20"Now this example uses a dynamic
> > context node however in the application these would exist as nodes in
> > the database...
> > If it does fully support this how do I enable it or get it to work?
> 
> One way to get started with BaseX would be to use the "basexgui" program
> in the bin directory to create a database (there's also a command-line
> program to do it; I use the Perl and PHP APIs too on
> www.fromoldbooks.org).
> 
> People usually do joins by value in XML and XQuery; ID/IDREF only work
> with older DTD technology, or with xml:id; I don't know if BaseX has
> support for them. But if it does the values must be IDs :)
> 
> So you're on the right lines.
> 
> >  Also what about XLink?
> 
> It's not used very much. As a standard it solved the wrong problems,
> unfortunately. Easy for me to say in hindsight.
> 
> The XQuery Use Cases on www.w3.org/TR may be helpful; there's also a
> chapter on XQuery using BaseX for examples in a book I co-authored last
> year, "Beginning XML" 5th edition.
> 
> Liam
> 
> -- 
> Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
> Pictures from old books: http://fromoldbooks.org/
> Ankh: irc.sorcery.net irc.gnome.org freenode/#xml
> 
  ___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] Question regarding BaseX support for id and idref

2013-05-13 Thread Liam R E Quin
On Mon, 2013-05-13 at 19:15 -0600, James Wright wrote:
> [...] I know the xml standard defines id and idref however I have not
> been able to find any documentation on these in BaseX or XML in
> general. For example does BaseX handle idiosyncrasies of id and idref
> or must I handle these in my queries? For example:
> let $context := 

Note that an XML ID must be an identifier, so must start with a name
start character (a letter)...

> let $context := 
>  
> 
> 
> for $itemWithFirstChild in $context/item[child/@name = 'firstChild']return 
> $itemWithFirstChild/@id

I think this got garbled somewhere - e.g. there aren't enough end tags.
Make sure you turn off HTML formatting in your email program.

> I would like this to return "10 20"Now this example uses a dynamic
> context node however in the application these would exist as nodes in
> the database...
> If it does fully support this how do I enable it or get it to work?

One way to get started with BaseX would be to use the "basexgui" program
in the bin directory to create a database (there's also a command-line
program to do it; I use the Perl and PHP APIs too on
www.fromoldbooks.org).

People usually do joins by value in XML and XQuery; ID/IDREF only work
with older DTD technology, or with xml:id; I don't know if BaseX has
support for them. But if it does the values must be IDs :)

So you're on the right lines.

>  Also what about XLink?

It's not used very much. As a standard it solved the wrong problems,
unfortunately. Easy for me to say in hindsight.

The XQuery Use Cases on www.w3.org/TR may be helpful; there's also a
chapter on XQuery using BaseX for examples in a book I co-authored last
year, "Beginning XML" 5th edition.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


[basex-talk] Question regarding BaseX support for id and idref

2013-05-13 Thread James Wright
Hello BaseX-Talk,
I am new to the boards and BaseX in general. I have been looking for a open 
source NoSQL database with expressive query abilities and I think BaseX fits 
the bill. Its been an exciting journey as I am new to the whole X platform 
aside from the angle brackets... As I think many are.
I am currently exploring the capabilities of RestXQ and the xml stack.  I 
especially like its potential coupled with knockout.js, and a truly flexible 
RESTful metadata/hypermedia driven api. I have implemented an api of this 
nature in .Net however the metadata and querying capabilities are hindered and 
unnecessarily complex where I feel xml and XQuery make this dynamic 
orchestration quite gracefully. 
Unfortunately I am stuck now that I am exploring referential relationships and 
xml. I am trying to understand the support BaseX and XML in general has for 
referential nodes especially when dealing with queries. For example I know the 
xml standard defines id and idref however I have not been able to find any 
documentation on these in BaseX or XML in general. For example does BaseX 
handle idiosyncrasies of id and idref or must I handle these in my queries? For 
example:
let $context :=
   

for $itemWithFirstChild in $context/item[child/@name = 'firstChild']return 
$itemWithFirstChild/@id
I would like this to return "10 20"Now this example uses a dynamic context node 
however in the application these would exist as nodes in the database...
If it does fully support this how do I enable it or get it to work?  Also what 
about XLink?
Any help would be greatly appreciated. Thanks again for your time.- James




  ___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk