From: Robert Varga Date: Wed, 20 Mar 2019 09:17:00 +0000 (+0100) Subject: Define PathExpression is a separate concept X-Git-Tag: v3.0.0~84 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=7d221cc5f801e38941eeb504325060c1206e7072;p=yangtools.git Define PathExpression is a separate concept RevisionAwareXPath is not what leafref types are referencing, define PathExpression which captures the proper semantic concept, which is based on YangLocationPath. JIRA: YANGTOOLS-969 Change-Id: I1f4a670d13a39ca60cda4771bb7ff46a90449bfe Signed-off-by: Robert Varga --- diff --git a/features/odl-yangtools-parser-api/pom.xml b/features/odl-yangtools-parser-api/pom.xml index 248b27fd4b..9534f7bfce 100644 --- a/features/odl-yangtools-parser-api/pom.xml +++ b/features/odl-yangtools-parser-api/pom.xml @@ -42,6 +42,12 @@ xml features + + org.opendaylight.yangtools + odl-yangtools-xpath-api + xml + features + org.opendaylight.yangtools odlext-model-api diff --git a/yang/yang-model-api/pom.xml b/yang/yang-model-api/pom.xml index e069469cd4..3764225ce6 100644 --- a/yang/yang-model-api/pom.xml +++ b/yang/yang-model-api/pom.xml @@ -30,6 +30,10 @@ org.opendaylight.yangtools yang-common + + org.opendaylight.yangtools + yang-xpath-api + com.google.guava guava diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/PathExpression.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/PathExpression.java new file mode 100644 index 0000000000..f3a251ae6c --- /dev/null +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/PathExpression.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2019 PANTHEON.tech, s.r.o. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yangtools.yang.model.api; + +import com.google.common.annotations.Beta; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.concepts.Immutable; +import org.opendaylight.yangtools.yang.xpath.api.YangBinaryOperator; +import org.opendaylight.yangtools.yang.xpath.api.YangFunction; +import org.opendaylight.yangtools.yang.xpath.api.YangLocationPath; +import org.opendaylight.yangtools.yang.xpath.api.YangLocationPath.QNameStep; +import org.opendaylight.yangtools.yang.xpath.api.YangXPathAxis; +import org.opendaylight.yangtools.yang.xpath.api.YangXPathExpression; + +/** + * An expression as defined in RFC7950 Section 9.9.2, + * i.e. the argument of a {@code path} statement. + * + *

+ * Semantically a {@link PathExpression} is similar to a {@link YangXPathExpression} with guarantees around what + * subexpressions it can contain: + *

    + *
  • the root expression must be a {@link YangLocationPath}
  • + *
  • it can contain steps only along {@link YangXPathAxis#DESCENDANT} and {@link YangXPathAxis#PARENT} axis
  • + *
  • all steps along {@link YangXPathAxis#DESCENDANT} axis are {@link QNameStep}
  • + *
  • the only function invocation is {@link YangFunction#CURRENT}
  • + *
  • only {@link YangBinaryOperator#EQUALS} is allowed
  • + *
  • no literals nor numbers are allowed
  • + *
+ * + * @author Robert Varga + */ +@Beta +public interface PathExpression extends Immutable { + /** + * Return the {@link YangLocationPath} of this expression. + * + * @return The location path + */ + @NonNull YangLocationPath getLocation(); +}