From: Rob V. <rv...@vd...> - 2010-06-10 13:46:37
|
Hi Michael When I said dotNetRDF works with Linq I meant it is designed so you can use it with Microsoft's System.Linq namespace. LinqToRdf is a now inactive project (afaik) developed by the guy who now runs Semantic Overflow which was a Linq style wrapper around the also inactive SemWeb library which mapped from Linq methods into SPARQL queries. So when I say dotNetRDF supports Linq what I'm talking about is the fact that many objects and methods are defined as IEnumerable<T> which means that all of Microsoft's Linq methods for IEnumerable<T> can be used. For example you can do something like the following: Graph g = new Graph(); //Get some data from somewhere... //Use the Linq OrderBy() method to order Triples by predicate foreach (Triple t in g.Triples.OrderBy(item => item.Predicate)) { //Do something with each Triple } Or equally you can use the natural language style syntax to do things: //Use Linq natural language syntax with a where clause to select Triples with a Blank Node subject IEnumerable<Triple> ts = from t in g.Triples where t.Subject.NodeType == NodeType.Blank select t; So basically any of the methods defined by the Enumerable class in the System.Linq namespace can be used against many of the objects and their methods from the dotNetRDF library - http://msdn.microsoft.com/en-us/library/bb345746%28v=VS.100%29.aspx Hope this helped explain things a little, if you want more information/examples please let me know. Regards, Rob Vesse ---------------------------------------- From: Michael Friis <fr...@gm...> Sent: 09 June 2010 21:55 To: rv...@vd... Subject: dotNetRDF and Linq Hi Rob, you mention in this answer that dotNetRDF works with Linq: http://www.semanticoverflow.com/questions/448/what-are-microsofts-offerings-in-the-semantic-world/458#458 Could you describe this in more detail? I'm looking at LinqtoRDF, but it seems kinda old and kinda broke... Michael -- http://friism.com (+45) 27122799 Sapere aude |