Hi there! I am just new to Marklogic/Xquery and is currently working on a
project where I need to transform the files from an existing database with
millions of xml documents, change each files' document structure while
ingesting it to another database.
So far, I have this transform module:

xquery version "1.0-ml";

module namespace master-person = "http://marklogic.com/ofis/masterperson";;

declare namespace fad = "http://marklogic.com/ofis/fad";;


declare variable $person := /fad:fadperson;


declare function master-person:transform(

  $content as map:map,

  $context as map:map

) as map:map*

{

 for $docs in fn:collection("fadperson") [1 to 100]

  for $p in fn:doc(fn:base-uri($docs))/fad:fadperson

(:  let $map := map:map() :)

  let $id := $p/fad:id/fn:string()

  let $profile :=

          <person>

            <id>{$p/fad:id/fn:string()}</id>

            <name>

              <firstname>{$p/fad:first_name/fn:string()}</firstname>

              <lastname>{$p/fad:last_name/fn:string()}</lastname>

              <middlename>{$p/fad:last_name/fn:string()}</middlename>


<nameextension>{$p/fad:name_extension/fn:string()}</nameextension>

              <othername>{$p/fad:other_name/fn:string()}</othername>

            </name>


            <gender>{$p/fad:gender/fn:string()}</gender>

            <civilstatus>{$p/fad:civil_status/fn:string()}</civilstatus>

            <birthdate>{$p/fad:birthdate/fn:string()}</birthdate>

            <birthplace>{$p/fad:birthplace/fn:string()}</birthplace>

         </person>

 return

    (

      map:put($content, "uri", fn:concat("/fadperson/", $id, ".xml"))

      ,

      map:put($content, "value", document { $profile })

      ,

      $content

    )



};


I also have installed this in my current XDBC server:

xquery version "1.0-ml";
xdmp:document-load("/home/jema/Marklogic/apps/data-transform/transform-person.xqy",
    <options xmlns="xdmp:document-load">
        <uri>/data/transform-person.xqy</uri>
      <repair>none</repair>
      <permissions>{xdmp:default-permissions()}</permissions>
    </options>)


Then I execute this on terminal:
 mlcp.sh copy -mode local -input_host localhost -input_port 8004
-input_username fad-admin -input_password f4d123 -output_host localhost
-output_port 8041 -output_username fad-admin -input_password f4d123
-collection_filter
'fadperson' -transform_module /data/transform-person.xqy
-transform_namespace "http://marklogic.com/ofis/masterperson";

the input_port: 8004 = contains the files for transformation;
output_port:8041 = where the transformed files must be ingested

It doesn't output anything. Neither an error is showing up. It reached 100%
complete yet no files loaded to the database.
What am I missing here? Is my transform module code not creating a
document?


Thanks!

Matt
jemate...@gmail.com
_______________________________________________
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to