gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-22 08:53:05 24 4
gpt4 key购买 nike

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

XdiCommonRoot.getSelfPeerRoot介绍

暂无

代码示例

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

public static XDIArc getOwnerPeerRootXDIArc(Graph graph) {
  XdiPeerRoot selfPeerRoot = XdiCommonRoot.findCommonRoot(graph).getSelfPeerRoot();
  if (selfPeerRoot == null) return null;
  return selfPeerRoot.getXDIArc();
}

代码示例来源: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

/**
 * Checks if this XDI peer root is the self XDI peer root of the graph.
 * @return True, if this is the self XDI peer root.
 */
public boolean isSelfPeerRoot() {
  XdiPeerRoot selfPeerRoot = this.findCommonRoot().getSelfPeerRoot();
  if (this.equals(selfPeerRoot)) return true;
  ContextNode refContextNode = Equivalence.getReferenceContextNode(this.getContextNode());
  XdiPeerRoot refPeerRoot = refContextNode == null ? null : XdiPeerRoot.fromContextNode(refContextNode);
  if (refPeerRoot != null && refPeerRoot.equals(selfPeerRoot)) return true;
  ContextNode repContextNode = Equivalence.getReplacementContextNode(this.getContextNode());
  XdiPeerRoot repPeerRoot = repContextNode == null ? null : XdiPeerRoot.fromContextNode(repContextNode);
  if (repPeerRoot != null && repPeerRoot.equals(selfPeerRoot)) return true;
  return false;
}

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

if (XdiCommonRoot.findCommonRoot(graph).getSelfPeerRoot() != null) return;

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

public void testSelfPeerRoots() throws Exception {

    Graph graph = MemoryGraphFactory.getInstance().openGraph();
    XdiCommonRoot.findCommonRoot(graph).setSelfPeerRoot(XDIAddress.create("=!1111"));

    XdiPeerRoot selfPeerRoot = XdiCommonRoot.findCommonRoot(graph).getSelfPeerRoot();

    assertEquals(selfPeerRoot.getContextNode().getXDIAddress(), XDIAddress.create("(=!1111)"));
    assertEquals(XdiCommonRoot.findCommonRoot(graph).getPeerRoot(XDIAddress.create("=!1111"), false), selfPeerRoot);
    assertTrue(selfPeerRoot.isSelfPeerRoot());

    graph.close();
  }
}

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

XdiRoot xdiRoot = XdiCommonRoot.findCommonRoot(authorityResultGraph).getSelfPeerRoot();
if (xdiRoot == null) xdiRoot = XdiCommonRoot.findCommonRoot(authorityResultGraph);
if (xdiRoot == null) return;

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