Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using F# for the semantic web implementing in memory triple stores

What is an effective means of implementing an in memory semantic web triple store using the basic .NET collection classes using F#?

Are there any F# examples or projects already doing this?

like image 657
Moonlight Avatar asked Jan 24 '23 05:01

Moonlight


1 Answers

There is also SemWeb which is a C# library which provides it's own SQL based Triple Store - http://razor.occams.info/code/semweb/

I'm working on a new C# library for RDF called dotNetRDF and have just released the latest Alpha http://www.dotnetrdf.org.

Here's an equivalent program to the one spoon16 showed:

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

My library currently supports my own SQL databases, AllegroGraph, 4store, Joseki, Sesame, Talis and Virtuoso as backing stores

like image 124
RobV Avatar answered Jan 25 '23 19:01

RobV