Re: [MarkLogic Dev General] Pointing to a database: using its ID?

2012-10-22 Thread Geert Josten
Hi Florent,

Might be worth to have a look at the configuration manager that comes with
MarkLogic since 5.0..

Kind regards,
Geert

 -Oorspronkelijk bericht-
 Van: general-boun...@developer.marklogic.com [mailto:general-
 boun...@developer.marklogic.com] Namens Florent Georges
 Verzonden: zondag 21 oktober 2012 21:14
 Aan: Michael Blakeley; MarkLogic Developer Discussion
 Onderwerp: Re: [MarkLogic Dev General] Pointing to a database: using its
ID?

 Michael Blakeley wrote:

   Hi Michael,

  The only problem with ids is that they are not portable.  So
  the config file from one cluster won't work with another.  If
  that's acceptable, then ids should be fine.

   Good point, indeed.  But the scope is one MarkLogic Server
 instance (they are used only in the config file of a web
 application deployed on the instance, and they are not aimed at
 being sent to another instance), so it is fine then.

   Thank you!

 --
 Florent Georges
 http://fgeorges.org/
 http://h2oconsulting.be/
 ___
 General mailing list
 General@developer.marklogic.com
 http://developer.marklogic.com/mailman/listinfo/general
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Map Operator and Concurrency

2012-10-22 Thread John Snelson
On 21/10/12 00:36, Ryan Dew wrote:
 Sorry, I realized my test was flawed and the map operator does seem to
 interfere with concurrency. Does anyone know if there is any benefit of
 using the map operator over a flwor other than simpler syntax?

Generally the simple map operator is evaluated lazily, where a similar 
FLWOR expression is evaluated eagerly. Lazy evaluation is sometimes but 
not always a benefit. For example, if all the values from the loop are 
required, then lazy evaluation just adds overhead to the computation. 
However if only some of the values are needed, then lazy evaluation 
saves unnecessary computation.

John

-- 
John Snelson, Lead Engineerhttp://twitter.com/jpcs
MarkLogic Corporation http://www.marklogic.com
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


[MarkLogic Dev General] Merging Schema and Schematron in MarkLogic

2012-10-22 Thread Gnanaprakash.Bodireddy
Hi

Is there any way in MarkLogic to Validate a schema (which have Schematron 
internally)

Till now,
I have used Schema to validate the XML data and it went on well with commands 
like (validate strict xml document and validate full xml document)

After having a requirement of performing conditional validation, I went ahead 
with Schematron based on suggestion from markmail and followed steps in Github 
to do the tasks.

Now, I am planning to merge both Schema and Schematron. Is there a way in 
MarkLogic to validate XML using this merged schema? If yes, how to perform this?

Thanks and Regards,

Gnanaprakash Bodireddy
Sr Associate - Projects | IME
Cognizant Technology Solutions
VNET: 672103
(O): +91 (40) 4451 extn: 672103
(M): +91-8897575644

This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful.
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


[MarkLogic Dev General] XQuery 3.0

2012-10-22 Thread David Sargeant
I was just curious what the roadmap is for the following XQuery 3.0 features:

1. group by clause in FLWOR Expressions 

2.  allowing empty in for clause

3. Dynamic function calls

4. count clause in FLWOR Expressions



Thanks,

David___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Pointing to a database: using its ID?

2012-10-22 Thread Mike Sokolov
FWIW, we generally use the database names rather than their ids in our 
configuration files.  It's just easier to see what's going on if you 
have a lot of configuration data to sort through, and as Michael 
Blakeley pointed out, the ids won't be portable.  So if you have, say, a 
development setup and a production setup, they can share the same 
database names, but not the same database ids.  You can always get the 
id for a name using xdmp:database()

Also, there are some APIs (like the Java XCC API) that expect a name for 
specifying a database.  Maybe you can use ids there, too, but I'm not 
sure you can.

-Mike

On 10/21/2012 01:49 PM, Florent Georges wrote:
Hi,

For some configuration purpose, I have to point to databases
 from a config file.  Can I use the IDs of the databases, as
 returned by admin:get-database-ids()?  Are they guaranted not to
 change, ever?  And same for App Servers ?

Regards,



___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Pointing to a database: using its ID?

2012-10-22 Thread Florent Georges
Mike Sokolov wrote:

  Hi,

 So if you have, say, a development setup and a production
 setup, they can share the same database names, but not the same
 database ids.  You can always get the id for a name using
 xdmp:database()

  But my concern is that the name is not stable.  You can change
the name of one database, and in that case I want the config to
still point to the same database.  Of course, I always display
the name instead of the ID in the user interface ;-)

  And by nature the config file is not aimed at being shared
between instances, because it reflects a lot of other stuff
installed and managed by the application.  An export/import
process for the whole or part of the stuff would make sense
though, but then names would be used as part of that process,
among many other things.

  Thanks for the thoughts Mike, it's been useful to decide that
1/ I want to keep using IDs ;-), 2/ I want to stop using the name
I cache alongside the ID in the config (I rather want to always
retrieve it from the ID when presenting to the user), and 3/
I want to keep the cached name in the config file, just for
debugging purposes...

  Regards,


-- 
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


[MarkLogic Dev General] Range Index in Where Clause

2012-10-22 Thread David Sargeant
I'm wondering if ML uses a range index in the where portion of a FLOWR 
expression where applicable.  I could only find examples of 'order by'.  Thanks.



David___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Pointing to a database: using its ID?

2012-10-22 Thread Mike Sokolov
On 10/22/2012 10:38 AM, Florent Georges wrote:
But my concern is that the name is not stable.  You can change
 the name of one database, and in that case I want the config to
 still point to the same database.  Of course, I always display
 the name instead of the ID in the user interface ;-)

Hm - renaming - I never considered that; I guess we just don't use that 
feature :)

-Mike
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] XQuery 3.0

2012-10-22 Thread Ryan Dew
Not sure about 1,2,, and 4. But dynamic function calls are already in ML 6.

http://maxdewpoint.blogspot.com/2012/10/higher-order-functions-in-marklogic-6.html



On Mon, Oct 22, 2012 at 7:28 AM, David Sargeant da...@dsargeant.com wrote:

 I was just curious what the roadmap is for the following XQuery 3.0
 features:

 1. group by clause in FLWOR Expressions

 2.  allowing empty in for clause

 3. Dynamic function calls

 4. count clause in FLWOR Expressions


 Thanks,

 David

 ___
 General mailing list
 General@developer.marklogic.com
 http://developer.marklogic.com/mailman/listinfo/general


___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Range Index in Where Clause

2012-10-22 Thread Michael Blakeley
I would rephrase this as does the evaluator ever use indexes for where 
clauses? If indexes are used at all, I would expect ranges to work too. And 
with 6.0-1.1 the answer seems to be yes - but I would still recommend doing 
as much as possible in XPath predicates.

Here's a contrived test. In real life it would be very odd to have a 
dls:created element in the main document, but since the range index comes 
preconfigured it's handy for testing.

declare namespace dls=http://marklogic.com/xdmp/dls;;

xdmp:document-insert(
  'test/1',
  element a {
element b { 'c' },
element dls:created { xs:dateTime(xs:date('2012-12-01')) } }),
xdmp:document-insert(
  'test/2',
  element a {
element b { 'c' },
element dls:created { xs:dateTime(xs:date('2012-12-12')) } })
= ()

Now we have two documents that match the /a[b eq 'c'] portion of the 
expression, but with different dsl:created values. Let's write a test query 
that matches one, but not the other:

declare namespace dls=http://marklogic.com/xdmp/dls;;
xdmp:query-trace(true()),
for $n in /a[ b eq 'c' ]
where $n/dls:created  xs:dateTime(xs:date('2012-12-12'))
return $n

One document should match the dls:created constraint, and the other shouldn't. 
The actual results match expectations, but that could be due to filtering. 
Let's check the trace:

2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Analyzing path for $n: 
fn:collection()/a[b eq c]
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Step 1 is searchable: 
fn:collection()
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Step 2 is searchable: a[b eq 
c]
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Path is fully searchable.
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Gathering constraints.
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:14: Comparison contributed hash 
value constraint: b = c
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Step 2 predicate 1 contributed 
1 constraint: b eq c
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:14: Comparison contributed hash 
value constraint: b = c
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Step 2 predicate 1 contributed 
1 constraint: b eq c
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Step 2 contributed 2 
constraints: a[b eq c]
2012-10-22 09:06:18.661 Info: 8003-cq: at 5:9: Comparison contributed dateTime 
range value constraint: dls:created  xs:dateTime(2012-12-12T00:00:00)
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Where clause contributed 1 
constraint for $n: $n/dls:created  xs:dateTime(2012-12-12T00:00:00)
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Executing search.
2012-10-22 09:06:18.667 Info: 8003-cq: at 4:11: Selected 1 fragment to filter

That looks exactly as expected (aside from the duplication of b=c, anyway). If 
we increment the date to the 13th or the 31st, both fragments match. If we try 
to use a QName that doesn't have a range index, we lose the Comparison 
contributed dateTime range value constraint line. So it seems clear that the 
range index is used for the where-clause.

Note that the same expression will be unsearchable according to xdmp:plan, 
though. Presumably that's because the FLWOR expression taken as a whole is 
unsearchable. That's understandable, but a little frustrating.

Even knowing this, I would still recommend doing as much as possible in XPath 
predicates. For one thing, you can use xdmp:plan instead of xdmp:query-trace.

-- Mike

On 22 Oct 2012, at 08:02 , David Sargeant da...@dsargeant.com wrote:

 I'm wondering if ML uses a range index in the where portion of a FLOWR 
 expression where applicable.  I could only find examples of 'order by'.  
 Thanks.
 
 
 
 David
 
 ___
 General mailing list
 General@developer.marklogic.com
 http://developer.marklogic.com/mailman/listinfo/general

___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Range Index in Where Clause

2012-10-22 Thread Gajanan Chinchwadkar
If an xpath expression has a predicate with value, then element range index 
will be used, if available.
For example, in the following two cases a range index on xs:QName(title) will 
be used:
 a.  /bookstore/book[title=XQuery Programming]
 b. /bookstore/book[title=XQuery Programming]/author

However, if there is no value in the predicate then the range index will not be 
used:
 c. .  /bookstore/book[title]

The same logic applies to where clause. If there is a value in the where clause 
and a corresponding element range index, it will be used.
It is different in order by, where an index gets used even though there is no 
comparison predicate and value.

In 6.0.1-1, XPath based index can be defined. There are many situations when 
MarkLogic server attempts to find matching path range index. Again in order to 
use range index, there must be a comparison predicate in the query.

Thanks,

Gajanan

-Original Message-
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Michael Blakeley
Sent: Monday, October 22, 2012 9:47 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Range Index in Where Clause

I would rephrase this as does the evaluator ever use indexes for where 
clauses? If indexes are used at all, I would expect ranges to work too. And 
with 6.0-1.1 the answer seems to be yes - but I would still recommend doing 
as much as possible in XPath predicates.

Here's a contrived test. In real life it would be very odd to have a 
dls:created element in the main document, but since the range index comes 
preconfigured it's handy for testing.

declare namespace dls=http://marklogic.com/xdmp/dls;;

xdmp:document-insert(
  'test/1',
  element a {
element b { 'c' },
element dls:created { xs:dateTime(xs:date('2012-12-01')) } }), 
xdmp:document-insert(
  'test/2',
  element a {
element b { 'c' },
element dls:created { xs:dateTime(xs:date('2012-12-12')) } }) = ()

Now we have two documents that match the /a[b eq 'c'] portion of the 
expression, but with different dsl:created values. Let's write a test query 
that matches one, but not the other:

declare namespace dls=http://marklogic.com/xdmp/dls;;
xdmp:query-trace(true()),
for $n in /a[ b eq 'c' ]
where $n/dls:created  xs:dateTime(xs:date('2012-12-12'))
return $n

One document should match the dls:created constraint, and the other shouldn't. 
The actual results match expectations, but that could be due to filtering. 
Let's check the trace:

2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Analyzing path for $n: 
fn:collection()/a[b eq c]
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Step 1 is searchable: 
fn:collection()
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Step 2 is searchable: a[b eq 
c]
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Path is fully searchable.
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Gathering constraints.
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:14: Comparison contributed hash 
value constraint: b = c
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Step 2 predicate 1 contributed 
1 constraint: b eq c
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:14: Comparison contributed hash 
value constraint: b = c
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Step 2 predicate 1 contributed 
1 constraint: b eq c
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Step 2 contributed 2 
constraints: a[b eq c]
2012-10-22 09:06:18.661 Info: 8003-cq: at 5:9: Comparison contributed dateTime 
range value constraint: dls:created  xs:dateTime(2012-12-12T00:00:00)
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Where clause contributed 1 
constraint for $n: $n/dls:created  xs:dateTime(2012-12-12T00:00:00)
2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Executing search.
2012-10-22 09:06:18.667 Info: 8003-cq: at 4:11: Selected 1 fragment to filter

That looks exactly as expected (aside from the duplication of b=c, anyway). If 
we increment the date to the 13th or the 31st, both fragments match. If we try 
to use a QName that doesn't have a range index, we lose the Comparison 
contributed dateTime range value constraint line. So it seems clear that the 
range index is used for the where-clause.

Note that the same expression will be unsearchable according to xdmp:plan, 
though. Presumably that's because the FLWOR expression taken as a whole is 
unsearchable. That's understandable, but a little frustrating.

Even knowing this, I would still recommend doing as much as possible in XPath 
predicates. For one thing, you can use xdmp:plan instead of xdmp:query-trace.

-- Mike

On 22 Oct 2012, at 08:02 , David Sargeant da...@dsargeant.com wrote:

 I'm wondering if ML uses a range index in the where portion of a FLOWR 
 expression where applicable.  I could only find examples of 'order by'.  
 Thanks.
 
 
 
 David
 
 ___
 General mailing list
 General@developer.marklogic.com
 

Re: [MarkLogic Dev General] Range Index in Where Clause

2012-10-22 Thread David Sargeant
Thanks for the help!


David

On Oct 22, 2012, at 1:27 PM, Gajanan Chinchwadkar 
gajanan.chinchwad...@marklogic.com wrote:

 If an xpath expression has a predicate with value, then element range index 
 will be used, if available.
 For example, in the following two cases a range index on xs:QName(title) 
 will be used:
 a.  /bookstore/book[title=XQuery Programming]
 b. /bookstore/book[title=XQuery Programming]/author
 
 However, if there is no value in the predicate then the range index will not 
 be used:
 c. .  /bookstore/book[title]
 
 The same logic applies to where clause. If there is a value in the where 
 clause and a corresponding element range index, it will be used.
 It is different in order by, where an index gets used even though there is no 
 comparison predicate and value.
 
 In 6.0.1-1, XPath based index can be defined. There are many situations when 
 MarkLogic server attempts to find matching path range index. Again in order 
 to use range index, there must be a comparison predicate in the query.
 
 Thanks,
 
 Gajanan
 
 -Original Message-
 From: general-boun...@developer.marklogic.com 
 [mailto:general-boun...@developer.marklogic.com] On Behalf Of Michael Blakeley
 Sent: Monday, October 22, 2012 9:47 AM
 To: MarkLogic Developer Discussion
 Subject: Re: [MarkLogic Dev General] Range Index in Where Clause
 
 I would rephrase this as does the evaluator ever use indexes for where 
 clauses? If indexes are used at all, I would expect ranges to work too. And 
 with 6.0-1.1 the answer seems to be yes - but I would still recommend doing 
 as much as possible in XPath predicates.
 
 Here's a contrived test. In real life it would be very odd to have a 
 dls:created element in the main document, but since the range index comes 
 preconfigured it's handy for testing.
 
 declare namespace dls=http://marklogic.com/xdmp/dls;;
 
 xdmp:document-insert(
  'test/1',
  element a {
element b { 'c' },
element dls:created { xs:dateTime(xs:date('2012-12-01')) } }), 
 xdmp:document-insert(
  'test/2',
  element a {
element b { 'c' },
element dls:created { xs:dateTime(xs:date('2012-12-12')) } }) = ()
 
 Now we have two documents that match the /a[b eq 'c'] portion of the 
 expression, but with different dsl:created values. Let's write a test query 
 that matches one, but not the other:
 
 declare namespace dls=http://marklogic.com/xdmp/dls;;
 xdmp:query-trace(true()),
 for $n in /a[ b eq 'c' ]
 where $n/dls:created  xs:dateTime(xs:date('2012-12-12'))
 return $n
 
 One document should match the dls:created constraint, and the other 
 shouldn't. The actual results match expectations, but that could be due to 
 filtering. Let's check the trace:
 
 2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Analyzing path for $n: 
 fn:collection()/a[b eq c]
 2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Step 1 is searchable: 
 fn:collection()
 2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Step 2 is searchable: a[b eq 
 c]
 2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Path is fully searchable.
 2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Gathering constraints.
 2012-10-22 09:06:18.661 Info: 8003-cq: at 4:14: Comparison contributed hash 
 value constraint: b = c
 2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Step 2 predicate 1 
 contributed 1 constraint: b eq c
 2012-10-22 09:06:18.661 Info: 8003-cq: at 4:14: Comparison contributed hash 
 value constraint: b = c
 2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Step 2 predicate 1 
 contributed 1 constraint: b eq c
 2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Step 2 contributed 2 
 constraints: a[b eq c]
 2012-10-22 09:06:18.661 Info: 8003-cq: at 5:9: Comparison contributed 
 dateTime range value constraint: dls:created  
 xs:dateTime(2012-12-12T00:00:00)
 2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Where clause contributed 1 
 constraint for $n: $n/dls:created  xs:dateTime(2012-12-12T00:00:00)
 2012-10-22 09:06:18.661 Info: 8003-cq: at 4:11: Executing search.
 2012-10-22 09:06:18.667 Info: 8003-cq: at 4:11: Selected 1 fragment to filter
 
 That looks exactly as expected (aside from the duplication of b=c, anyway). 
 If we increment the date to the 13th or the 31st, both fragments match. If we 
 try to use a QName that doesn't have a range index, we lose the Comparison 
 contributed dateTime range value constraint line. So it seems clear that the 
 range index is used for the where-clause.
 
 Note that the same expression will be unsearchable according to xdmp:plan, 
 though. Presumably that's because the FLWOR expression taken as a whole is 
 unsearchable. That's understandable, but a little frustrating.
 
 Even knowing this, I would still recommend doing as much as possible in XPath 
 predicates. For one thing, you can use xdmp:plan instead of xdmp:query-trace.
 
 -- Mike
 
 On 22 Oct 2012, at 08:02 , David Sargeant da...@dsargeant.com wrote:
 
 I'm wondering if ML uses a range index in the where portion of a FLOWR 
 expression where