Marklogic DHF使用实体服务设计信封

Marklogic DHF使用实体服务设计信封,marklogic,marklogic-9,marklogic-dhf,Marklogic,Marklogic 9,Marklogic Dhf,我将DHF与实体服务一起使用。我想知道一个信封是否包含多个实体实例。我可以按如下方式设计信封吗 <envelope xmlns="http://marklogic.com/entity-services"> <headers> </headers> <triples> </triples> <instance> <info> <title>tar

我将DHF与实体服务一起使用。我想知道一个信封是否包含多个实体实例。我可以按如下方式设计信封吗

<envelope xmlns="http://marklogic.com/entity-services">
  <headers>
  </headers>
  <triples>
  </triples>
  <instance>
        <info>
          <title>target</title>
          <version>1.0.0</version>
        </info>
        <target:target xmlns:target="http://schemas.abbvienet.com/entity/target">
            ....
        </target>
  </instance>
  <instance>
        <info>
          <title>core</title>
          <version>1.0.0</version>
        </info>
        <core:core xmlns:core="http://schemas.abbvienet.com/entity/core">
            ....
        </core>
  </instance>
  <attachments>
  </attachments>
</envelope>
我想使用
es
api规范化实体

目前,DHF(和实体服务)支持按照信封模式为每个文档提供一个实例的范例

如果一个实体(或多个实体)的多个实例需要相同的附件/三元组/标题支持,只需将它们拆分并附加即可

此外,您确实不应该修改生成信封的实例部分:

<es:envelope xmlns:es="http://marklogic.com/entity-services">
  <es:instance>
    <es:info>
      <es:title>Person</es:title>
      <es:version>1.0.0</es:version>
    </es:info>
    <Person>
      <id>1234</id>
      <firstName>George</firstName>
      <lastName>Washington</lastName>
      <fullName>George Washington</fullName>
    </Person>
  </es:instance>
  <es:attachments>
    <person>
      <pid>1234</pid>
      <given>George</given>
      <family>Washington</family>
    </person>
  </es:attachments>
</es:envelope>

人
1.0.0
1234
乔治
华盛顿
乔治华盛顿
1234
乔治
华盛顿
但您可以根据需要在实例之外的其他位置添加信息。有关您的问题的实体服务的更多信息,请访问:


目前,ES和DataHub之间存在一点差距,我们正在积极努力缩小这一差距,这就是为什么我建议您不要修改默认实例设置,并为每个信封文档保留一个实例。

从另一个角度看,我要说的是,信封设计中没有任何东西阻止您的做法,特别是第一个。为了确保entity services生成的代码集中于
es:instance
元素的范围,我们付出了一些努力

我以为人们会设计像你这样的信封。然而,我不明白是什么激发了它。请分享你的进一步经验

<es:envelope xmlns:es="http://marklogic.com/entity-services">
  <es:instance>
    <es:info>
      <es:title>Person</es:title>
      <es:version>1.0.0</es:version>
    </es:info>
    <Person>
      <id>1234</id>
      <firstName>George</firstName>
      <lastName>Washington</lastName>
      <fullName>George Washington</fullName>
    </Person>
  </es:instance>
  <es:attachments>
    <person>
      <pid>1234</pid>
      <given>George</given>
      <family>Washington</family>
    </person>
  </es:attachments>
</es:envelope>