예제 #1
0
        protected override RelationResolution AnalyzeRelationResolution(XPathNavigator relationElement)
        {
            RelationResolution result = new RelationResolution();

            result.atomRelation = relationElement.Value;

            string atomRelationURI = relationElement.GetAttribute("uri", String.Empty).ToLower();

            switch (atomRelationURI)
            {
            case "nxbre://operator":
                result.type = AtomFunction.RelationResolutionType.NxBRE;
                break;

            case "nxbre://binder":
                if (Binder == null)
                {
                    throw new BREException("No binder available for relation: " + result.atomRelation);
                }
                result.type = AtomFunction.RelationResolutionType.Binder;
                break;

            case "nxbre://expression":
                result.type = AtomFunction.RelationResolutionType.Expression;
                break;

            default:
                result.type = AtomFunction.RelationResolutionType.None;
                break;
            }

            return(result);
        }
예제 #2
0
        protected override RelationResolution AnalyzeRelationResolution(XPathNavigator relationElement)
        {
            RelationResolution result = new RelationResolution();

            string lowerAtomRelation = relationElement.Value.ToLower();

            if (lowerAtomRelation.StartsWith("nxbre:"))
            {
                result.atomRelation = relationElement.Value;
                result.type         = AtomFunction.RelationResolutionType.NxBRE;
            }
            else if (lowerAtomRelation.StartsWith("binder:"))
            {
                result.atomRelation = relationElement.Value;
                result.type         = AtomFunction.RelationResolutionType.Binder;
            }
            else if (lowerAtomRelation.EndsWith("()"))
            {
                result.atomRelation = relationElement.Value;
                result.type         = AtomFunction.RelationResolutionType.Binder;
            }
            else if (lowerAtomRelation.StartsWith("expr:"))
            {
                result.atomRelation = relationElement.Value;
                result.type         = AtomFunction.RelationResolutionType.Expression;
            }
            else
            {
                result.atomRelation = relationElement.Value;
                result.type         = AtomFunction.RelationResolutionType.None;
            }
            return(result);
        }
예제 #3
0
        protected Atom GetAtom(XPathNavigator atom, bool negative, bool inHead, bool resolveImmediatly)
        {
            // build the array of predicates
            ArrayList         relationPredicates = new ArrayList();
            XPathNodeIterator predicates         = atom.Select(RelativePredicatesXPath);

            while (predicates.MoveNext())
            {
                relationPredicates.Add(BuildPredicate(predicates.Current, inHead, resolveImmediatly));
            }
            IPredicate[] predicatesArray = (IPredicate[])relationPredicates.ToArray(typeof(IPredicate));

            // identify function based atom relations
            XPathNodeIterator rel = atom.Select(RelativeRelationXPath);

            rel.MoveNext();
            RelationResolution relationResolution = AnalyzeRelationResolution(rel.Current);

            if ((relationResolution.type == AtomFunction.RelationResolutionType.NxBRE) ||
                (relationResolution.type == AtomFunction.RelationResolutionType.Binder))
            {
                return(new AtomFunction(relationResolution.type,
                                        negative,
                                        Binder,
                                        relationResolution.atomRelation,
                                        predicatesArray));
            }

            else if (relationResolution.type == AtomFunction.RelationResolutionType.Expression)
            {
                return(new AtomFunction(relationResolution.type,
                                        negative,
                                        new ExpressionRelater(relationResolution.atomRelation, predicatesArray),
                                        relationResolution.atomRelation,
                                        predicatesArray));
            }
            else
            {
                return(new Atom(negative,
                                relationResolution.atomRelation,
                                predicatesArray));
            }
        }
        protected override RelationResolution AnalyzeRelationResolution(XPathNavigator relationElement)
        {
            RelationResolution result = new RelationResolution();
            result.atomRelation = relationElement.Value;

            string atomRelationURI = relationElement.GetAttribute("uri", String.Empty).ToLower();

            switch(atomRelationURI) {
                case "nxbre://operator":
                    result.type = AtomFunction.RelationResolutionType.NxBRE;
                    break;

                case "nxbre://binder":
                    if (Binder == null) throw new BREException("No binder available for relation: " + result.atomRelation);
                    result.type = AtomFunction.RelationResolutionType.Binder;
                    break;

                case "nxbre://expression":
                    result.type = AtomFunction.RelationResolutionType.Expression;
                    break;

                default:
                    result.type = AtomFunction.RelationResolutionType.None;
                    break;
            }

            return result;
        }
예제 #5
0
        protected override RelationResolution AnalyzeRelationResolution(XPathNavigator relationElement)
        {
            RelationResolution result = new RelationResolution();

            string lowerAtomRelation = relationElement.Value.ToLower();

            if (lowerAtomRelation.StartsWith("nxbre:")) {
                result.atomRelation = relationElement.Value;
                result.type = AtomFunction.RelationResolutionType.NxBRE;
            }
            else if (lowerAtomRelation.StartsWith("binder:")) {
                result.atomRelation = relationElement.Value;
                result.type = AtomFunction.RelationResolutionType.Binder;
            }
            else if (lowerAtomRelation.EndsWith("()")) {
                result.atomRelation = relationElement.Value;
                result.type = AtomFunction.RelationResolutionType.Binder;
            }
            else if (lowerAtomRelation.StartsWith("expr:")) {
                result.atomRelation = relationElement.Value;
                result.type = AtomFunction.RelationResolutionType.Expression;
            }
            else {
                result.atomRelation = relationElement.Value;
                result.type = AtomFunction.RelationResolutionType.None;
            }
            return result;
        }