1

我发现很难找到有用的文档。基本上,我在我的露天内容模型中定义了两种自定义类型“Concept”和“ConceptScheme”。概念方案与许多子概念有关联。像这样:

        <type name="ancoat:conceptScheme">
            <title>Concept Scheme</title>
            <parent>ancoat:ddiObject</parent>
            <associations>
                <child-association name="ancoat:categories">
                   <source>
                       <mandatory>true</mandatory>
                       <many>false</many>
                   </source>
                   <target>
                       <class>ancoat:concept</class>
                       <mandatory>false</mandatory>
                       <many>true</many>
                   </target>
                   <duplicate>false</duplicate>
                   <propagateTimestamps>true</propagateTimestamps>
                </child-association>
            </associations>
            <mandatory-aspects>
                <aspect>ancoat:describedObject</aspect>
            </mandatory-aspects>
        </type>

我有两个 webscript,一个用于创建概念节点,一个用于概念方案。我现在想创建一个 webscript,它对这些对象中的每一个进行一些引用,并在它们之间创建一个关联。

我怎么做?我找到了函数 Node.createAssociation,但我找不到任何使用它的示例。

4

1 回答 1

1

那我会用java的方式回答你。

假设命名空间是http://ancoat.com/model/content/1.0前缀ancoat有这个关联:

public static final QName ANCOAT_CATEGORIES_ASSOC = QName.createQName("http://ancoat.com/model/content/1.0",
            categories);

然后,您可以使用节点服务将一个节点与其他节点相关联:

getNodeService().setAssociations(pNode, ANCOAT_CATEGORIES_ASSOC, targets);

pNode一个节点在哪里,以及targets要与之关联的节点列表。

现在,使用子关联,这可能是使用该方法的更好addChild方法:

getNodeService().addChild(parentRefs, childRef, assocTypeQName, qname)
于 2016-07-20T15:54:29.600 回答