Hi Frank,
Glad to hear it works now.
Yeah, by default the transform module only query against the database
associated with the XDBC server MLCP is talking to.
To query other database, you can try passing in the 5th parameter $forest-ids
to cts:search.
$forest-ids can be fetched by calling
xdmp:database-forests(xdmp:database("your_database"))
Hope this helps.
Aries
From: [email protected]
[mailto:[email protected]] On Behalf Of
[email protected]
Sent: Wednesday, June 22, 2016 1:51 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] MLCP import transform and search
Hi Aries,
Thanks it is working now.
Only when I want to get documents from a sub-database it's still empty.
Hi Rob,
We are orienting.
But if you load every day the same document with bitemporal, after 7 day there
are 7 till 13 documents. In which only the bitemporal dateTime elements are
different.
We want to reduce this to 1 document.
This because one of the project to use ML is to store billions of documents.
1 of the options is to check if the current document and the document from the
day before are the same.
If so, we can delete the current document, before loading.
From: Rob Szkutak
<[email protected]<mailto:[email protected]>>
To: MarkLogic Developer Discussion
<[email protected]<mailto:[email protected]>>
Date: 22-06-2016 19:51
Subject: Re: [MarkLogic Dev General] MLCP import transform and search
Sent by:
[email protected]<mailto:[email protected]>
________________________________
Hi,
To answer your question directly, yes, you can run a search within an MLCP
transform.
Regarding your specific transform, how big is the "docs" collection? If you're
trying to paste a large number of other documents and their URIs into the
incoming document you're probably going to run into some pretty big problems.
This leads me to ask, why are you trying to paste an entire collection of
documents and URIs into an incoming document in the first place? There's
probably a better way to do this.
Best,
Rob
Rob Szkutak
Senior Consultant
MarkLogic Corporation
[email protected]<mailto:[email protected]>
www.marklogic.com<http://www.marklogic.com/>
________________________________
From:
[email protected]<mailto:[email protected]>
[[email protected]] on behalf of Aries Li
[[email protected]]
Sent: Wednesday, June 22, 2016 12:45 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] MLCP import transform and search
Hi Frank,
If you login QConsole with $USER that was passed into mlcp, can you get result
by running the cts query in the transform module?
I expect mlcp transform module can run the query with privileges from $USER.
Aries
From:
[email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of
[email protected]<mailto:[email protected]>
Sent: Wednesday, June 22, 2016 8:48 AM
To: [email protected]<mailto:[email protected]>
Subject: [MarkLogic Dev General] MLCP import transform and search
Hi,
Is it possible in MLCP IMPORT within a TRANSFORM to search on the (same)
database?
To enrich the data (from same database) I use the transform option.
But in below transformation the raw data is loaded in the database with empty
elements a,b and c (structure is ok)
Questions:
- is it possible to do a MLCP IMPORT with a search in a transform (xquery) and
get data from same (sub-)database
- or do I have to adjust my security role (Which role do I need, currently I
use role admin )
- or .............
MLCP call:
mlcp.sh import \
-mode local \
-host localhost \
-port $PORT \
-username $USER \
-password $PASS \
-input_file_path /home/cent/Desktop/$SRCS \
-document_type xml \
-input_file_type aggregates \
-aggregate_record_element record \
-database Dummy \
-content_encoding "UTF-8" \
-namespace http://ml.com/$SRCS \
-output_collections $COLL \
-transform_module /src/transform/transform.xqy \
-transform_namespace http://ml.com/mlcp-transform \
-transform_param $PARM \
-tolerate_errors true \
-xml_repair_level full
/src/transform/transform.xqy:
xquery version "1.0-ml";
module namespace ingest = "http://ml.com/mlcp-transform";
declare function ingest:transform(
$content as map:map,
$context as map:map
)
{
let $doc := map:get($content, "value")
(: Normally the below search function are more specific based on element values
in $doc :)
let $a := cts:search(fn:doc(), cts:collection-query("docs"), "unfiltered")
let $b := cts:uris((),(),cts:collection-query("docs"))
let $c := fn:collection("docs")[1]
(: removed transformation part :)
(: but $a, $b and $c are empty :)
(: Same function in QControl gives results :)
let $_1 := <new-record>
<raw>{$doc}</raw>
<a>{$a}</a>
<b>{$b}</b>
<c>{$c}</c>
</new-record>
let $_2 := map:put($content, "value", $_1)
return $content
};
Kind Regards,
Frank Jansen
This message has been sent by ABN AMRO Bank N.V., which has its seat at Gustav
Mahlerlaan 10 (1082 PP) Amsterdam, the Netherlands, and is registered in the
Commercial Register of Amsterdam under number
34334259._______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general
This message has been sent by ABN AMRO Bank N.V., which has its seat at Gustav
Mahlerlaan 10 (1082 PP) Amsterdam, the Netherlands, and is registered in the
Commercial Register of Amsterdam under number 34334259.
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general