使用F#的基本.NET集合类实现内存中的语义web三元组存储的有效方法是什么?
是否有任何F#示例或项目已经在这样做了?
发布于 2009-09-28 10:57:35
还有SemWeb,这是一个C#库,它提供了自己的基于SQL三重存储- http://razor.occams.info/code/semweb/
我正在为RDF开发一个名为dotNetRDF的新C#库,并且刚刚发布了最新的Alpha http://www.dotnetrdf.org。
这是一个与spoon16展示的程序等效的程序:
open System
open VDS.RDF
open VDS.RDF.Parsing
open VDS.RDF.Query
//Get a Graph and fill it from a file
let g = new Graph()
let parser = new TurtleParser()
parser.Load(g, "test.ttl")
//Place into a Triple Store and query
let store = new TripleStore()
store.Load(g)
let results = store.ExecuteQuery("SELECT ?s ?p ?o WHERE {?s ?p ?o} LIMIT 10") :?> SparqlResultSet
//Output the results
Console.WriteLine(results.Count.ToString() ^ " Results")
for result in results.Results do
Console.WriteLine(result.ToString())
done
//Wait for user to hit enter so they can see the results
Console.ReadLine() |> ignore我的图书馆目前支持我自己的SQL数据库、AllegroGraph、4store、Joseki、Sesame、Talis和Virtuoso作为后备存储。
发布于 2009-10-12 03:07:28
查看LinqToRdf,它除了简单的VS.NET托管建模工具外,还提供了完整的LINQ查询提供程序和处理内存中数据库时的往返数据:
var 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);
} 发布于 2009-09-06 22:26:01
作为其Semantics SDK的一部分,Intellidimension提供了一个基于.NET的内存三元组存储。如果你联系他们,他们通常会提供免费的研究/教育许可证。
我每天都在C#和PowerShell上使用他们的技术,我真的很享受。
//disclaimer: really the first time I have used F# so this may not be any good...
//but it does work
open Intellidimension.Rdf
open System.IO
let rdfXml = File.ReadAllText(@"C:\ontology.owl")
let gds = new GraphDataSource()
gds.Read(rdfXml) |> ignore
let tbl = gds.Query("select ?s ?p ?o where {?s ?p ?o} limit 10")
System.Console.Write(tbl.RowCount)
System.Console.ReadLine() |> ignorehttps://stackoverflow.com/questions/1386406
复制相似问题