private ISparqlPath TryParsePathSequence(SparqlQueryParserContext context, Queue<IToken> tokens) { ISparqlPath path = this.TryParsePathEltOrInverse(context, tokens); IToken next; while (tokens.Count > 0) { next = tokens.Peek(); switch (next.TokenType) { case Token.DIVIDE: tokens.Dequeue(); path = new SequencePath(path, this.TryParsePathEltOrInverse(context, tokens)); break; case Token.HAT: tokens.Dequeue(); path = new SequencePath(path, new InversePath(this.TryParsePathElt(context, tokens))); break; default: return path; } } return path; }
public void SparqlPropertyPathTransformationSequence() { SequencePath path = new SequencePath(new Property(this._factory.CreateUriNode(new Uri(RdfSpecsHelper.RdfType))), new Property(this._factory.CreateUriNode(new Uri(NamespaceMapper.RDFS + "subClassOf")))); this.RunTest(path, new String[] { "BGP" }); }
public void SparqlPropertyPathEvaluationSequencedAlternatives() { EnsureTestData(); INode a = this._factory.CreateUriNode(new Uri(RdfSpecsHelper.RdfType)); INode b = this._factory.CreateUriNode(new Uri(NamespaceMapper.RDFS + "range")); SequencePath path = new SequencePath(new AlternativePath(new Property(a), new Property(b)), new AlternativePath(new Property(a), new Property(a))); ISparqlAlgebra algebra = this.GetAlgebraUntransformed(path); SparqlEvaluationContext context = new SparqlEvaluationContext(null, this._data); BaseMultiset results = algebra.Evaluate(context); TestTools.ShowMultiset(results); Assert.IsFalse(results.IsEmpty, "Results should not be empty"); }
public void SparqlPropertyPathTransformationSequencedAlternatives() { INode a = this._factory.CreateUriNode(new Uri("ex:a")); INode b = this._factory.CreateUriNode(new Uri("ex:b")); INode c = this._factory.CreateUriNode(new Uri("ex:c")); INode d = this._factory.CreateUriNode(new Uri("ex:d")); SequencePath path = new SequencePath(new AlternativePath(new Property(a), new Property(c)), new AlternativePath(new Property(b), new Property(d))); this.RunTest(path, new String[] { "BGP" }); }