{"action":"opened","issue":{"url":"https://api.github.com/repos/marklogic-community/marklogic-data-hub/issues/792","repository_url":"https://api.github.com/repos/marklogic-community/marklogic-data-hub","labels_url":"https://api.github.com/repos/marklogic-community/marklogic-data-hub/issues/792/labels{/name}","comments_url":"https://api.github.com/repos/marklogic-community/marklogic-data-hub/issues/792/comments","events_url":"https://api.github.com/repos/marklogic-community/marklogic-data-hub/issues/792/events","html_url":"https://github.com/marklogic-community/marklogic-data-hub/issues/792","id":304176325,"number":792,"title":"Related entity scaffolding code not generated for new harmonize flow","user":{"login":"damonfeldman","id":700633,"avatar_url":"https://avatars2.githubusercontent.com/u/700633?v=4","gravatar_id":"","url":"https://api.github.com/users/damonfeldman","html_url":"https://github.com/damonfeldman","followers_url":"https://api.github.com/users/damonfeldman/followers","following_url":"https://api.github.com/users/damonfeldman/following{/other_user}","gists_url":"https://api.github.com/users/damonfeldman/gists{/gist_id}","starred_url":"https://api.github.com/users/damonfeldman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damonfeldman/subscriptions","organizations_url":"https://api.github.com/users/damonfeldman/orgs","repos_url":"https://api.github.com/users/damonfeldman/repos","events_url":"https://api.github.com/users/damonfeldman/events{/privacy}","received_events_url":"https://api.github.com/users/damonfeldman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-11T17:24:02Z","updated_at":"2018-03-11T17:24:02Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"\r\n#### The issue\r\n\r\nI have a PersonMaster with a reference to an Address in my Entity Model, but the code to generate Address information is not generated when I create a new Harmonize flow using the entity template.\r\n\r\nWhat behavior are you expecting?\r\nI'm expecting a function (XQuery) that has the Address creation template, and a call to that function from the main PersonMaster template.\r\n\r\n#### Tech details\r\n\r\nWhich Operating System are you using?\r\nOSX\r\n\r\nWhich version of MarkLogic are you using?\r\n9.0-3.1\r\n\r\nWhich version of the Data Hub Framework are you using?\r\n2.0-4\r\n\r\n#### The devil is in the details...\r\n\r\nIf possible, rerun the command with -d for debugging output and attach the output:\r\n\r\n  **for quickstart:**  \r\n  `java -jar quickstart.war -d > myoutput.txt`\r\n\r\n  **for gradle:**  \r\n  `gradle mlYourCommand -d > myoutput.txt`\r\n\r\n## generated code (without reference to Address is)\r\n\r\nxquery version \"1.0-ml\";\r\n\r\nmodule namespace plugin = \"http://marklogic.com/data-hub/plugins\";\r\n\r\nimport module namespace es = \"http://marklogic.com/entity-services\"\r\n  at \"/MarkLogic/entity-services/entity-services.xqy\";\r\n\r\ndeclare option xdmp:mapping \"false\";\r\n\r\n(:~\r\n : Create Content Plugin\r\n :\r\n : @param $id          - the identifier returned by the collector\r\n : @param $options     - a map containing options. Options are sent from Java\r\n :\r\n : @return - your transformed content\r\n :)\r\ndeclare function plugin:create-content(\r\n  $id as xs:string,\r\n  $options as map:map) as map:map\r\n{\r\n  let $doc := fn:doc($id)\r\n  let $source :=\r\n    if ($doc/es:envelope) then\r\n      $doc/es:envelope/es:instance/node()\r\n    else if ($doc/instance) then\r\n      $doc/instance\r\n    else\r\n      $doc\r\n  return\r\n    plugin:extract-instance-PersonMaster($source)\r\n};\r\n\r\n(:~\r\n : Creates a map:map instance from some source document.\r\n : @param $source-node  A document or node that contains\r\n :   data for populating a PersonMaster\r\n : @return A map:map instance with extracted data and\r\n :   metadata about the instance.\r\n :)\r\ndeclare function plugin:extract-instance-PersonMaster(\r\n    $source as node()?\r\n) as map:map\r\n{\r\n  (: the original source documents :)\r\n  let $attachments := $source\r\n\r\n  let $first-name as xs:string? := ()\r\n  let $last-name as xs:string? := ()\r\n  let $government-id as xs:string? := ()\r\n\r\n  (: return the in-memory instance :)\r\n  (: using the XQuery 3.0 syntax... :)\r\n  let $model := json:object()\r\n  let $_ := (\r\n    map:put($model, '$attachments', $attachments),\r\n    map:put($model, '$type', 'PersonMaster'),\r\n    map:put($model, '$version', '0.0.1'),\r\n    es:optional($model, 'first-name', $first-name),\r\n    es:optional($model, 'last-name', $last-name),\r\n    es:optional($model, 'government-id', $government-id)\r\n  )\r\n\r\n  (: if you prefer the xquery 3.1 version with the => operator....\r\n   : https://www.w3.org/TR/xquery-31/#id-arrow-operator\r\n  let $model :=\r\n    json:object()\r\n      =>map:with('$attachments', $attachments)\r\n      =>map:with('$type', 'PersonMaster')\r\n      =>map:with('$version', '0.0.1')\r\n      =>es:optional('first-name', $first-name)\r\n      =>es:optional('last-name', $last-name)\r\n      =>es:optional('government-id', $government-id)\r\n  :)\r\n  return\r\n    $model\r\n};\r\n\r\ndeclare function plugin:make-reference-object(\r\n  $type as xs:string,\r\n  $ref as xs:string)\r\n{\r\n  let $o := json:object()\r\n  let $_ := (\r\n    map:put($o, '$type', $type),\r\n    map:put($o, '$ref', $ref)\r\n  )\r\n  return\r\n    $o\r\n};\r\n\r\nattaching entity defs below"}}
{"actor":{"display_login":"damonfeldman"}}