public void TestGetAlbum() { var ctx = new MusicDataContext(Properties.Settings.Default.testSparqlEndpoint); IQueryable<Album> q1 = from a in ctx.Albums where a.Name == "Thomas Laqueur - History Lectures" select a; Album[] aa = q1.ToArray(); Assert.IsTrue(aa.Count() == 1); }
public void TestGetAlbum() { var ctx = new MusicDataContext(@"http://localhost/linqtordf/SparqlQuery.aspx"); IQueryable<Album> q1 = from a in ctx.Albums where a.Name == "Thomas Laqueur - History Lectures" select a; Album[] aa = q1.ToArray(); Assert.IsTrue(aa.Count() == 1); }
public void TestSum() { var ctx = new MusicDataContext(@"http://localhost/linqtordf/SparqlQuery.aspx"); var albums = (from a in ctx.Albums where a.Name.StartsWith("Thomas") select a); Assert.IsTrue(albums.Sum(a=>1) == 1); }
public void TestFirstOrDefault() { var ctx = new MusicDataContext(@"http://localhost/linqtordf/SparqlQuery.aspx"); var albums = (from a in ctx.Albums where a.Name.StartsWith("Thomas") select a); Assert.IsTrue(albums.FirstOrDefault() != null); }
public void TestSum() { var ctx = new MusicDataContext(Properties.Settings.Default.testSparqlEndpoint); var albums = (from a in ctx.Albums where a.Name.StartsWith("Thomas") select a); Assert.IsTrue(albums.Sum(a=>1) == 1); }
public void TestAlbumToTracks() { var ctx = new MusicDataContext(Properties.Settings.Default.testSparqlEndpoint); Album album = (from a in ctx.Albums where a.Name.StartsWith("Thomas") select a).First(); Assert.IsNotNull(album); Assert.IsTrue(album.Tracks.Count() > 1); }
public void TestAlbumToTracks() { var ctx = new MusicDataContext(@"http://localhost/linqtordf/SparqlQuery.aspx"); Album album = (from a in ctx.Albums where a.Name.StartsWith("Thomas") select a).First(); Assert.IsNotNull(album); Assert.IsTrue(album.Tracks.Count() > 1); }
public void TestSimpleTestWithLet() { var ctx = new MusicDataContext("http://localhost/linqtordf/SparqlQuery.aspx"); var q = from a in ctx.Albums let c = a.Tracks.Count() where c > 5 select a; var count = q.Count(); Assert.IsTrue(count > 0); }
public void TestTrackToAlbum1() { var ctx = new MusicDataContext(@"http://localhost/linqtordf/SparqlQuery.aspx"); IQueryable<Track> q = from t in ctx.Tracks where t.Year == "2006" && t.GenreName == "History 5" select t; Track[] ta = q.ToArray(); Assert.IsTrue(ta.Count() == 2); Assert.IsTrue(ta[0].AlbumName == "Thomas Laqueur - History Lectures"); Assert.IsTrue(ta[0].Album != null); }
public void TestTrackToAlbum1() { var ctx = new MusicDataContext(Properties.Settings.Default.testSparqlEndpoint); IQueryable<Track> q = from t in ctx.Tracks where t.Year == "2006" && t.GenreName == "History 5" select t; try { Track[] ta = q.ToArray(); Assert.IsTrue(ta.Count() == 2); Assert.IsTrue(ta[0].AlbumName == "Thomas Laqueur - History Lectures"); Assert.IsTrue(ta[0].Album != null); } catch { Console.WriteLine(((LinqToSparqlQuery<Track>)q).QueryText); throw; } }
public void SparqlQueryWithTheLot() { TripleStore ts = CreateSparqlTripleStore(); MusicDataContext ctx = new MusicDataContext(@"http://localhost/linqtordf/SparqlQuery.aspx"); var q = (from t in ctx.Tracks where t.Year == "2006" && t.GenreName == "History 5 | Fall 2006 | UC Berkeley" orderby t.FileLocation select new {t.Title, t.FileLocation}).Skip(10).Take(5); foreach (var track in q) { Console.WriteLine(track.Title + ": " + track.FileLocation); } }
public void QueryWithProjection() { var ctx = new MusicDataContext(@"http://localhost/linqtordf/SparqlQuery.aspx"); var q = from t in ctx.Tracks where t.Year == "2006" && t.GenreName == "History 5" select new {t.Title, t.FileLocation}; Assert.IsTrue(q.ToList().Count() == 2); }