[MarkLogic Dev General] Reduce the query execution time for cts:value-tuples

2015-07-05 Thread shruti kapoor
Hi, I have a cts:value-tuples() query which fetches the json array result. The query runs on aprroximately 3lac xmls and the result set contains about 30k elements in json array. It takes about 48sec to run this query. Is there a way to reduce its execution time. I have used range indexes for

[MarkLogic Dev General] How to include inference rules

2015-07-05 Thread prateekjai...@gmail.com
Hi, I am facing issue while using custom inference rules in marklogic 8.0. Here is the scenario: 1. create data PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# PREFIX place: http://example.com/places/ PREFIX ex: http://example.com/ PREFIX bank: http://example.com/banks/ INSERT DATA {

Re: [MarkLogic Dev General] Reduce the query execution time for cts:value-tuples

2015-07-05 Thread Geert Josten
Hi Shruti, If you want to expose a UI in which an end user can navigate through all 30k values, I’d suggest applying pagination. You could have a look at the /v1/values REST api endpoint, but I don’t expect it to be faster, or not much. In the end you have to serialize a large number of

Re: [MarkLogic Dev General] Reduce the query execution time for cts:value-tuples

2015-07-05 Thread Geert Josten
Hi Shruti, I think that you will find that if you wrap the cts:value-tuples in a count that it will run much faster, maybe even in sub-sec. Most time is consumed by serializing 30k json arrays. Do you really need all 30k items, or would top 20 be sufficient? Cheers, Geert From: shruti kapoor

Re: [MarkLogic Dev General] Reduce the query execution time for cts:value-tuples

2015-07-05 Thread shruti kapoor
Hi Geert, I need all 30k results and since the response is in json array, I convert it into a map first then each map goes through some data enrichment to finally generate an html table. Could I useany other search api ? Thanks Shruti On 6 Jul 2015 01:50, Geert Josten geert.jos...@marklogic.com

Re: [MarkLogic Dev General] How to include inference rules

2015-07-05 Thread Geert Josten
Hi Prateek, I see two options: 1. Specify ruleset programmatically using a sem:ruleset-store (see http://docs.marklogic.com/guide/semantics/inferencing#id_pgfId-920824) 2. Use default rulesets, which is a config setting for databases (see

Re: [MarkLogic Dev General] How to include inference rules

2015-07-05 Thread Geert Josten
Hi Prateek, Which error do you get? Cheers, Geert From: prateekjai...@gmail.commailto:prateekjai...@gmail.com prateekjai...@gmail.commailto:prateekjai...@gmail.com Reply-To: MarkLogic Developer Discussion general@developer.marklogic.commailto:general@developer.marklogic.com Date: Sunday, July

Re: [MarkLogic Dev General] How to include inference rules

2015-07-05 Thread Geert Josten
Hi Prateek, It would help if you provide more detail. If you run this query from Qconsole, against which database are you running it then (the dropdown at the top of QConsole)? And does this database contain triple data? You can discover that using the Explore button which should reveal XML

Re: [MarkLogic Dev General] How to include inference rules

2015-07-05 Thread prateekjai...@gmail.com
Thanks Geert, I have already created rule for inferencing by: xquery version 1.0-ml; xdmp:document-insert( '/rules/bankAt.rules', text{ ' PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema/ PREFIX ex: http://example.com/ PREFIX gn:

Re: [MarkLogic Dev General] How to include inference rules

2015-07-05 Thread prateekjai...@gmail.com
Hi Geert, I am running this script now. It runs w/o error but doesnt return ant results. I am not sure if, I am missing something here. Also, I am not sure how to pass my data in query like, I want to get all banks in uk. let $my-store := sem:ruleset-store(/rules/bankAt.rules, sem:store() )

Re: [MarkLogic Dev General] General Digest, Vol 133, Issue 16

2015-07-05 Thread Erik Hennum
Hi, zisedeqing: You might consider writing queries with cts:search() so you don't need to look into the interpretation of the FLWOR expression. The following query should get close to what you want (though you may see some false positives if you run unfiltered without position indexes).

Re: [MarkLogic Dev General] General Digest, Vol 133, Issue 16

2015-07-05 Thread 张晓博
Thanks Rob , I had got the query plan by used xdmp:query-trace(), but marklogic will really execute the xquery when i used xdmp:query-trace(). Is there another method that i can get the query plan and the query will be not really exeuted? Message: 2 Date: Mon, 6 Jul 2015 02:43:12 +

[MarkLogic Dev General] How can i get the query plan for FWLOR query statement?

2015-07-05 Thread 张晓博
The xquery is: for $x in collection('test')/catalog/product where $x/@dept = 'WMN' return $x; I had created attribute range index on product/@dept, I would like to know whether the query will use the range index when marklogic process it. so i ues the xdmp:plan to get the query plan, but i only

Re: [MarkLogic Dev General] How can i get the query plan for FWLOR query statement?

2015-07-05 Thread Rob Szkutak
Hi, xdmp:plan() requires a partially searchable XPath expression or a cts:search() expression. It doesn't accept xQuery like that. More information: https://docs.marklogic.com/xdmp:plan Here's an example that would work for you: xdmp:plan(collection('test')/catalog/product/@dept) Another