gpt4 book ai didi

xdi2.core.util.XDIAddressUtil.extractXDIAddress()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 14:00:40 25 4
gpt4 key购买 nike

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

XDIAddressUtil.extractXDIAddress介绍

[英]Finds a part of an XDI address that matches a certain node type.
[中]查找与特定节点类型匹配的XDI地址的一部分。

代码示例

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

private XDIAddress replaceXDIAddress(XDIAddress XDIaddress) {
    XDIAddress replacedXDIAddress = XDIAddressUtil.extractXDIAddress(XDIaddress, this.clazzes, this.keepOnlyFirstFound, this.keepOnlyLastFound, this.keepAllFound, this.keepParent, this.keepLocal);
    return replacedXDIAddress != null ? replacedXDIAddress : XDIaddress;
  }
}

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

public static <X extends XdiContext<?>> XDIAddress extractXDIAddress(XDIAddress XDIaddress, Class<X> clazz, boolean keepOnlyFirstFound, boolean keepOnlyLastFound, boolean keepAllFound, boolean keepParent, boolean keepLocal) {
  @SuppressWarnings("unchecked")
  Class<? extends XdiContext<?>>[] clazzes = (Class<? extends XdiContext<?>>[]) Array.newInstance(clazz.getClass(), 1);
  clazzes[0] = clazz;
  return extractXDIAddress(XDIaddress, clazzes, keepOnlyFirstFound, keepOnlyLastFound, keepAllFound, keepParent, keepLocal);
}

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

@Override
public XDIClientRoute<?> route(XDIAddress XDIaddress) throws Xdi2AgentException, Xdi2ClientException {
  // let's find out the TO peer root of the address
  XDIAddress peerRootXDIAddress = XDIAddressUtil.extractXDIAddress(XDIaddress, XdiPeerRoot.class, false, false, true, false, false);
  XDIArc peerRootFirstXDIArc = peerRootXDIAddress == null ? null : peerRootXDIAddress.getFirstXDIArc();
  XDIArc firstXDIArc = XDIaddress.getFirstXDIArc();
  if (log.isDebugEnabled()) log.debug("Peer root first arc: " + peerRootFirstXDIArc + ", First arc: " + firstXDIArc);
  XDIArc toPeerRootXDIArc = null;
  if (toPeerRootXDIArc == null && peerRootFirstXDIArc != null) toPeerRootXDIArc = peerRootFirstXDIArc;
  if (toPeerRootXDIArc == null && firstXDIArc != null) toPeerRootXDIArc = XdiPeerRoot.createPeerRootXDIArc(XDIAddress.fromComponent(firstXDIArc));
  if (log.isDebugEnabled()) log.debug("Determined TO peer root: " + toPeerRootXDIArc);
  if (toPeerRootXDIArc == null) {
    if (log.isDebugEnabled()) log.debug("Unable to determine TO peer root for address " + XDIaddress);
    return null;
  }
  // let's find a route
  return route(toPeerRootXDIArc);
}

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

public static XDIAddress getRequestingAuthority(XDIAddress XDIaddress) {
  XDIaddress = XDIAddressUtil.extractXDIAddress(XDIaddress, XdiInnerRoot.class, false, true, false, false, true);
  if (XDIaddress == null) return null;
  XDIArc linkContractInnerRootXDIArc = XDIaddress.getFirstXDIArc();
  if (! XdiInnerRoot.isValidXDIArc(linkContractInnerRootXDIArc)) return null;
  return XdiInnerRoot.getPredicateOfInnerRootXDIArc(linkContractInnerRootXDIArc);
}

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

public static XDIAddress getAuthorizingAuthority(XDIAddress XDIaddress) {
  XDIaddress = XDIAddressUtil.extractXDIAddress(XDIaddress, XdiInnerRoot.class, false, true, false, false, true);
  if (XDIaddress == null) return null;
  XDIArc linkContractInnerRootXDIArc = XDIaddress.getFirstXDIArc();
  if (! XdiInnerRoot.isValidXDIArc(linkContractInnerRootXDIArc)) return null;
  return XdiInnerRoot.getSubjectOfInnerRootXDIArc(linkContractInnerRootXDIArc);
}

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

public static XDIAddress getTemplateAuthorityAndId(XDIAddress XDIaddress) {
  XDIaddress = XDIAddressUtil.extractXDIAddress(XDIaddress, XdiInnerRoot.class, false, true, false, false, true);
  if (XDIaddress == null) return null;
  int index = XDIAddressUtil.indexOfXDIArc(XDIaddress, XDILinkContractConstants.XDI_ARC_CONTRACT);
  if (index < 0) index = XDIAddressUtil.indexOfXDIArc(XDIaddress, XdiEntityCollection.createXDIArc(XDILinkContractConstants.XDI_ARC_CONTRACT));
  XDIAddress templateAuthorityAndId = XDIAddressUtil.subXDIAddress(XDIaddress, 1, index);
  if (XDIConstants.XDI_ADD_ROOT.equals(templateAuthorityAndId)) return null;
  return templateAuthorityAndId;
}

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

/**
 * Checks if an XDI entity class is a valid XDI message collection.
 * @param xdiEntityCollection The XDI entity class to check.
 * @return True if the XDI entity class is a valid XDI message collection.
 */
public static boolean isValid(XdiEntityCollection xdiEntityCollection) {
  if (! xdiEntityCollection.getContextNode().getXDIArc().equals(XdiEntityCollection.createXDIArc(XDIMessagingConstants.XDI_ARC_MSG))) return false;
  if (XDIAddressUtil.extractXDIAddress(xdiEntityCollection.getContextNode().getXDIAddress(), XdiInnerRoot.class, false, false, true, false, false) != null) return false;
  return true;
}

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

assertEquals(XDIAddress.create(""), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiCommonRoot.class, false, false, true, false, false));
assertEquals(XDIAddress.create("(=a)(=b)"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiPeerRoot.class, false, false, true, false, false));
assertEquals(XDIAddress.create("(=a)"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiPeerRoot.class, true, false, false, false, false));
assertEquals(XDIAddress.create("(=b)"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiPeerRoot.class, false, true, false, false, false));
assertEquals(XDIAddress.create("(=a)(=b)(=c/+d)"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiRoot.class, false, false, true, false, false));
assertEquals(XDIAddress.create("(=c/+d)"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiInnerRoot.class, false, false, true, false, false));
assertEquals(XDIAddress.create("=!:uuid:1111"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiEntity.class, false, false, true, false, false));
assertEquals(XDIAddress.create("=!:uuid:1111"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiEntitySingleton.class, false, false, true, false, false));
assertEquals(XDIAddress.create("<#first><#name>"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiAttribute.class, false, false, true, false, false));
assertEquals(XDIAddress.create("<#first><#name>"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiAttributeSingleton.class, false, false, true, false, false));
assertEquals(XDIAddress.create(""), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiCommonRoot.class, false, false, true, true, false));
assertEquals(XDIAddress.create("(=a)(=b)"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiPeerRoot.class, false, false, true, true, false));
assertEquals(XDIAddress.create("(=a)"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiPeerRoot.class, true, false, false, true, false));
assertEquals(XDIAddress.create("(=b)"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiPeerRoot.class, false, true, false, true, false));
assertEquals(XDIAddress.create("(=a)(=b)(=c/+d)"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiRoot.class, false, false, true, true, false));
assertEquals(XDIAddress.create("(=a)(=b)(=c/+d)"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiInnerRoot.class, false, false, true, true, false));
assertEquals(XDIAddress.create("(=a)(=b)(=c/+d)=!:uuid:1111"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiEntity.class, false, false, true, true, false));
assertEquals(XDIAddress.create("(=a)(=b)(=c/+d)=!:uuid:1111"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiEntitySingleton.class, false, false, true, true, false));
assertEquals(XDIAddress.create("(=a)(=b)(=c/+d)=!:uuid:1111<#first><#name>"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiAttribute.class, false, false, true, true, false));
assertEquals(XDIAddress.create("(=a)(=b)(=c/+d)=!:uuid:1111<#first><#name>"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiAttributeSingleton.class, false, false, true, true, false));
assertEquals(XDIAddress.create("(=a)(=b)(=c/+d)=!:uuid:1111<#first><#name>"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiCommonRoot.class, false, false, true, false, true));
assertEquals(XDIAddress.create("(=a)(=b)(=c/+d)=!:uuid:1111<#first><#name>"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiPeerRoot.class, false, false, true, false, true));
assertEquals(XDIAddress.create("(=a)(=b)(=c/+d)=!:uuid:1111<#first><#name>"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiRoot.class, false, false, true, false, true));
assertEquals(XDIAddress.create("(=c/+d)=!:uuid:1111<#first><#name>"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiInnerRoot.class, false, false, true, false, true));
assertEquals(XDIAddress.create("=!:uuid:1111<#first><#name>"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiEntity.class, false, false, true, false, true));
assertEquals(XDIAddress.create("=!:uuid:1111<#first><#name>"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiEntitySingleton.class, false, false, true, false, true));
assertEquals(XDIAddress.create("<#first><#name>"), XDIAddressUtil.extractXDIAddress(XDIaddress, XdiAttribute.class, false, false, true, false, true));

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

org.openrdf.model.Resource context = null;
XDIAddress rootXDIAddress = XDIAddressUtil.extractXDIAddress(XDIstatement.getContextNodeXDIAddress(), XdiPeerRoot.class, false, false, true, false, false);
  if (subjectXDIAddress == null) subjectXDIAddress = XDIConstants.XDI_ADD_ROOT;
  XDIAddress predicateXDIAddress = XDIAddressUtil.extractXDIAddress(subjectXDIAddress, XdiAttribute.class, false, false, true, false, true);

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