/** * Checks if a context node is a valid XDI unordered entity instance. * @param contextNode The context node to check. * @return True if the context node is a valid XDI unordered entity instance. */ public static boolean isValid(ContextNode contextNode) { if (contextNode == null) throw new NullPointerException(); if (contextNode.getXDIArc() == null || ! isValidXDIArc(contextNode.getXDIArc())) return false; if (contextNode.getContextNode() != null && XdiAttributeCollection.isValid(contextNode.getContextNode())) return false; if (contextNode.getContextNode() != null && XdiAbstractAttribute.isValid(contextNode.getContextNode())) return false; return true; }
/** * Checks if a context node is a valid XDI entity singleton. * @param contextNode The context node to check. * @return True if the context node is a valid XDI entity singleton. */ public static boolean isValid(ContextNode contextNode) { if (contextNode == null) throw new NullPointerException(); if (contextNode.getXDIArc() == null || ! isValidXDIArc(contextNode.getXDIArc())) return false; if (contextNode.getContextNode() != null && XdiAttributeCollection.isValid(contextNode.getContextNode())) return false; if (contextNode.getContextNode() != null && XdiAbstractAttribute.isValid(contextNode.getContextNode())) return false; return true; }
/** * Checks if a context node is a valid XDI entity collection. * @param contextNode The context node to check. * @return True if the context node is a valid XDI entity collection. */ public static boolean isValid(ContextNode contextNode) { if (contextNode == null) throw new NullPointerException(); if (contextNode.getXDIArc() == null || ! isValidXDIArc(contextNode.getXDIArc())) return false; if (contextNode.getContextNode() != null && XdiAttributeCollection.isValid(contextNode.getContextNode())) return false; if (contextNode.getContextNode() != null && XdiAbstractAttribute.isValid(contextNode.getContextNode())) return false; return true; }
/** * Returns the parent XDI collection of this XDI ordered attribute instance. * @return The parent XDI collection. */ @Override public XdiAttributeCollection getXdiCollection() { return XdiAttributeCollection.fromContextNode(this.getContextNode().getContextNode()); }
public static XdiAttributeCollection getAttributeIndex(Graph graph, XDIArc indexXDIArc, boolean create) { XDIArc xdiAttributeCollectionXDIArc = XdiAttributeCollection.createXDIArc(indexXDIArc); ContextNode contextNode = create ? graph.getRootContextNode().getContextNode(xdiAttributeCollectionXDIArc) : graph.getRootContextNode().getContextNode(xdiAttributeCollectionXDIArc); if (contextNode == null) return null; return XdiAttributeCollection.fromContextNode(contextNode); }
/** * Returns the parent XDI collection of this XDI unordered attribute instance. * @return The parent XDI collection. */ @Override public XdiAttributeCollection getXdiCollection() { return XdiAttributeCollection.fromContextNode(this.getContextNode().getContextNode()); }
public ContextNode getBaseContextNode() { ContextNode contextNode = (this.getXdiAttribute() instanceof XdiAttributeInstance) ? this.getXdiAttribute().getContextNode().getContextNode() : this.getXdiAttribute().getContextNode(); contextNode = contextNode.getContextNode(); return contextNode; }
public ContextNode getBaseContextNode() { ContextNode contextNode = (this.getXdiAttribute() instanceof XdiAttributeInstance) ? this.getXdiAttribute().getContextNode().getContextNode() : this.getXdiAttribute().getContextNode(); contextNode = contextNode.getContextNode(); return contextNode; }
@Override public XdiPeerRoot getPeerRoot(XDIArc peerRootXDIArc, boolean create) { if (log.isTraceEnabled()) log.trace("getPeerRoot(" + peerRootXDIArc + "," + create + ")"); ContextNode peerRootContextNode = create ? this.getContextNode().setContextNode(peerRootXDIArc) : this.getContextNode().getContextNode(peerRootXDIArc, false); if (peerRootContextNode == null) return null; return XdiPeerRoot.fromContextNode(peerRootContextNode); }
public ContextNode getBaseContextNode() { ContextNode contextNode = (this.getXdiAttribute() instanceof XdiAttributeInstance) ? this.getXdiAttribute().getContextNode().getContextNode() : this.getXdiAttribute().getContextNode(); contextNode = contextNode.getContextNode(); return contextNode; }
@Override public XdiPeerRoot getPeerRoot(XDIAddress XDIaddress, boolean create) { if (log.isTraceEnabled()) log.trace("getPeerRoot(" + XDIaddress + "," + create + ")"); XDIArc peerRootXDIArc = XdiPeerRoot.createPeerRootXDIArc(XDIaddress); ContextNode peerRootContextNode = create ? this.getContextNode().setContextNode(peerRootXDIArc) : this.getContextNode().getContextNode(peerRootXDIArc, false); if (peerRootContextNode == null) return null; return new XdiPeerRoot(peerRootContextNode); }
@Override public XdiInnerRoot getInnerRoot(XDIAddress subject, XDIAddress predicate, boolean create) { if (log.isTraceEnabled()) log.trace("getInnerRoot(" + subject + "," + predicate + "," + create + ")"); XDIArc innerRootXDIArc = XdiInnerRoot.createInnerRootXDIArc(subject, predicate); ContextNode innerRootContextNode = create ? this.getContextNode().setContextNode(innerRootXDIArc) : this.getContextNode().getContextNode(innerRootXDIArc, false); if (innerRootContextNode == null) return null; return new XdiInnerRoot(innerRootContextNode); }
/** * gets an XDI instance under this XDI collection. * @return The XDI instance. */ public U getXdiInstanceUnordered(boolean attribute, boolean immutable, boolean relative, String literal) { if (literal == null) throw new NullPointerException(); XDIArc XDIarc = XdiAbstractInstanceUnordered.createXDIArc(attribute, immutable, relative, literal, null); ContextNode instanceContextNode = this.getContextNode().getContextNode(XDIarc, false); if (instanceContextNode == null) return null; return XdiAbstractContext.fromContextNode(instanceContextNode, this.getU()); }
@Override public XdiEntitySingleton getXdiEntitySingleton(XDIArc XDIarc, boolean create) { ContextNode entitySingletonContextNode = create ? this.getContextNode().setContextNode(XDIarc) : this.getContextNode().getContextNode(XDIarc, false); if (entitySingletonContextNode == null) return null; return XdiEntitySingleton.fromContextNode(entitySingletonContextNode); }
@Override public XdiAttribute getXdiAttribute(XDIArc XDIarc, boolean create) { ContextNode attributeContextNode = create ? this.getContextNode().setContextNode(XDIarc) : this.getContextNode().getContextNode(XDIarc, false); if (attributeContextNode == null) return null; return XdiAbstractAttribute.fromContextNode(attributeContextNode); }
@Override public XdiAttributeCollection getXdiAttributeCollection(XDIArc XDIarc, boolean create) { ContextNode attributeCollectionContextNode = create ? this.getContextNode().setContextNode(XDIarc) : this.getContextNode().getContextNode(XDIarc, false); if (attributeCollectionContextNode == null) return null; return XdiAttributeCollection.fromContextNode(attributeCollectionContextNode); }
/** * Factory method that creates an XDI message bound to a given XDI entity. * @param xdiEntity The XDI entity that is an XDI message. * @return The XDI message. */ public static Message fromXdiEntity(XdiEntity xdiEntity) { XdiEntityCollection xdiEntityCollection = XdiEntityCollection.fromContextNode(xdiEntity.getContextNode().getContextNode()); MessageCollection messageCollection = xdiEntityCollection == null ? null : MessageCollection.fromXdiEntityCollection(xdiEntityCollection); if (messageCollection == null) return null; return fromMessageCollectionAndXdiEntity(messageCollection, xdiEntity); }
@Override public XdiEntityCollection getXdiEntityCollection(XDIArc XDIarc, boolean create) { ContextNode entityCollectionContextNode = create ? this.getContextNode().setContextNode(XDIarc) : this.getContextNode().getContextNode(XDIarc, false); if (entityCollectionContextNode == null) return null; return XdiEntityCollection.fromContextNode(entityCollectionContextNode); }
@Override public XdiEntity getXdiEntity(XDIArc XDIarc, boolean create) { ContextNode entityContextNode = create ? this.getContextNode().setContextNode(XDIarc) : this.getContextNode().getContextNode(XDIarc, false); if (entityContextNode == null) return null; return XdiAbstractEntity.fromContextNode(entityContextNode); }
public static XdiEntityCollection getEntityIndex(Graph graph, XDIArc indexXDIArc, boolean create) { XDIArc xdiEntityCollectionXDIArc = XdiEntityCollection.createXDIArc(indexXDIArc); ContextNode contextNode = create ? graph.getRootContextNode().setContextNode(xdiEntityCollectionXDIArc) : graph.getRootContextNode().getContextNode(xdiEntityCollectionXDIArc); if (contextNode == null) return null; return XdiEntityCollection.fromContextNode(contextNode); }