public void ExecuteTripleStoreWithPatternlessQueryGetsDescriptionOfSingleUri() { SparqlQuery query = new SparqlQuery("DESCRIBE <http://example.com/subject>"); TripleStoreStore store = new TripleStoreStore(); TripleStore results = query.ExecuteTripleStore(store); Assert.IsTrue(store.WasGetDescriptionOfCalledWith(new UriRef("http://example.com/subject"), new CbdBoundingStrategy()), "Query should not invoke triple store's Solve method"); }
public void ExecuteTripleStoreWithPatternlessQueryDoesNotPassQueryToTripleStore() { SparqlQuery query = new SparqlQuery("DESCRIBE <http://example.com/subject>"); TripleStoreStore store = new TripleStoreStore(); TripleStore results = query.ExecuteTripleStore(store); Assert.AreEqual(false, store.WasSolveCalledWith(query), "Query should not invoke triple store's Solve method"); }
public void ExecuteTripleStorePassesDescribeQueryToTripleStore() { SparqlQuery query = new SparqlQuery("DESCRIBE ?var WHERE { <http://example.com/subject> <http://example.com/predicate> ?var }"); TripleStoreStore store = new TripleStoreStore(); TripleStore results = query.ExecuteTripleStore(store); Assert.IsTrue(store.WasSolveCalledWith(query), "Query should invoke triple store's Solve method"); }
public void DescribeQueryUsesSpecifiedBoundingStrategy() { SparqlQuery query = new SparqlQuery("DESCRIBE <http://example.com/subject>"); TripleStoreStore store = new TripleStoreStore(); BoundingStrategyStub strategy = new BoundingStrategyStub(); query.BoundingStrategy = strategy; TripleStore results = query.ExecuteTripleStore(store); Assert.IsTrue(store.WasGetDescriptionOfCalledWith(new UriRef("http://example.com/subject"), strategy), "Query should use specified bounding strategy"); }
public void ExecuteTripleStoreWithPatternsQueryReturnsDescriptions() { SparqlQuery query = new SparqlQuery("DESCRIBE ?var WHERE {<http://example.com/subject> <http://example.com/pred> ?var }"); TripleStore store = new MemoryTripleStore(); store.Add(new Statement(new UriRef("http://example.com/subject"), new UriRef("http://example.com/pred"), new UriRef("http://example.com/obj"))); store.Add(new Statement(new UriRef("http://example.com/obj"), new UriRef("http://example.com/pred"), new UriRef("http://example.com/thing"))); TripleStoreVerifier verifier = new TripleStoreVerifier(); verifier.expect("<http://example.com/obj> <http://example.com/pred> <http://example.com/thing> ."); TripleStore results = query.ExecuteTripleStore(store); Assert.IsTrue(verifier.verify(results), "Resulting triple store should contain describing triples"); }
public void ExecuteTripleStoreWithPatternlessQueryButUsingVariablesThrowsException() { SparqlQuery query = new SparqlQuery("DESCRIBE ?var"); TripleStoreStore store = new TripleStoreStore(); TripleStore results = query.ExecuteTripleStore(store); }