gpt4 book ai didi

xdi2.core.features.nodetypes.XdiCommonRoot.getContextNode()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 09:01:05 25 4
gpt4 key购买 nike

本文整理了Java中xdi2.core.features.nodetypes.XdiCommonRoot.getContextNode()方法的一些代码示例,展示了XdiCommonRoot.getContextNode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XdiCommonRoot.getContextNode()方法的具体详情如下:
包路径:xdi2.core.features.nodetypes.XdiCommonRoot
类名称:XdiCommonRoot
方法名:getContextNode

XdiCommonRoot.getContextNode介绍

暂无

代码示例

代码示例来源:origin: projectdanube/xdi2

public XdiPeerRoot getSelfPeerRoot() {

    Relation relation = this.getContextNode().getRelation(XDIDictionaryConstants.XDI_ADD_IS_REF);
    if (relation == null) return null;

    ContextNode targetContextNode = relation.followContextNode();
    if (targetContextNode == null) return null;

    return XdiPeerRoot.fromContextNode(targetContextNode);
  }
}

代码示例来源:origin: projectdanube/xdi2

public XdiPeerRoot setSelfPeerRoot(XDIAddress XDIaddress) {
  XdiPeerRoot selfPeerRoot = this.getSelfPeerRoot();
  if (selfPeerRoot != null) selfPeerRoot.getContextNode().delete();
  if (XDIaddress == null) return null;
  selfPeerRoot = this.getPeerRoot(XDIaddress, true);
  ContextNode commonRootContextNode = this.getContextNode();
  ContextNode selfPeerRootContextNode = selfPeerRoot.getContextNode();
  commonRootContextNode.delRelations(XDIDictionaryConstants.XDI_ADD_IS_REF);
  commonRootContextNode.setRelation(XDIDictionaryConstants.XDI_ADD_IS_REF, selfPeerRootContextNode);
  selfPeerRootContextNode.delRelations(XDIDictionaryConstants.XDI_ADD_REF);
  selfPeerRootContextNode.setRelation(XDIDictionaryConstants.XDI_ADD_REF, commonRootContextNode);
  return selfPeerRoot;
}

代码示例来源:origin: projectdanube/xdi2

public void testCommonRoot() throws Exception {

    Graph graph = MemoryGraphFactory.getInstance().openGraph();

    assertEquals(XdiCommonRoot.findCommonRoot(graph).getContextNode(), graph.getRootContextNode());
    assertEquals(XdiCommonRoot.findCommonRoot(graph).getContextNode().getXDIAddress(), XDIConstants.XDI_ADD_ROOT);

    graph.close();
  }
}

代码示例来源:origin: projectdanube/xdi2

public void testSubGraph() throws Exception {

    Graph graph = MemoryGraphFactory.getInstance().openGraph();
    XdiCommonRoot localRoot = XdiCommonRoot.findCommonRoot(graph);
    XdiPeerRoot peerRoot = localRoot.getPeerRoot(XDIAddress.create("=!:uuid:91f28153-f600-ae24-91f2-8153f600ae24"), true);
    XdiInnerRoot innerRoot = peerRoot.getInnerRoot(XDIAddress.create("=!1111"), XDIAddress.create("$add"), true);
    
    assertTrue(XdiAbstractContext.fromContextNode(localRoot.getContextNode()) instanceof XdiCommonRoot);
    assertTrue(XdiAbstractContext.fromContextNode(peerRoot.getContextNode()) instanceof XdiPeerRoot);
    assertTrue(XdiAbstractContext.fromContextNode(innerRoot.getContextNode()) instanceof XdiInnerRoot);
    
    graph.close();
  }
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com