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



我正在将DHF与Entity-Services一起使用。我想知道一个信封是否包含多个实体实例,我可以将信封设计如下

<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>

注意2个实例的2个instance标签。

这是有效的,因为我无法找到信封设计的建议,例如xsd?这是信封中实例的良好设计还是有更好的方法?还是我可以喜欢这个

<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>
    <core:core xmlns:core="http://schemas.abbvienet.com/entity/core">
                    ....
    </core>
  </instance>
  <attachments>
  </attachments>
</envelope>

我想使用es API进行规范化实体

当前DHF(和Entity Services(支持每个文档的一个实例范式,按照信封模式。

如果您需要针对实体(或多个实体(的多个实例的相同附件/三元/标头支持 - 只需将它们拆分并附加。

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

<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>

但是您可以根据需要在实例之外的其他地方添加信息。有关与您的问题有关的实体服务的更多信息,请参见:https://docs.marklogic.com/guide/entity-services/instances/Instances#ID_67461

当前,我们正在积极关闭ES和DataHub之间有一些差距,这就是为什么我鼓励您不要修改默认实例设置并在每个信封文档中保留一个实例。

对于另一种角度,我要说的是,信封设计中没有什么可以阻止您的方法,尤其是第一个方法。采取一些痛苦来确保实体服务生成集中于es:instance元素范围的代码。

我预计人们会设计像您这样的信封。但是,我不明白什么可能激发它。请分享您的进一步经验。

最新更新