LinqToRdf v0.7.1 and RdfMetal

Posted on June 9, 2008. Filed under: .NET, Semantic Web, SemanticWeb, programming, science |

I’ve just uploaded version 0.7.1 of LinqToRdf. This bug fix release corrects an issue I introduced in version 0.7. The issue only seemed to affect some machines and stems from the use of the GAC by the WIX installer (to the best of my knowledge). I’ve abandoned GAC installation and gone back to the original approach.

Early indications (Thanks, Hinnerk) indicate that the issue has been successfully resolved. Please let me know if you are still experiencing problems. Thanks to 13sides, Steve Dunlap, Hinnerk Bruegmann, Kevin Richards and Paul Stovell for bringing it to my attention and helping me to overcome the allure of the GAC.

Kevin also reported that he’s hoping to use LinqToRdf on a project involving the Biodiversity Information Standards (TDWG). It’s always great to hear how people are using the framework. Please drop me a line to let me know how you are using LinqToRdf.

Kevin might find feature #13 useful. It will be called RdfMetal in honour of SqlMetal. It will automate the process of working with remotely managed ontologies. RdfMetal will completely lower any barriers to entry in semantic web development. You will (in principle) no longer need to know the formats, protocols and standards of the semantic web in order to consume data in it.

clip_image001[5]

Here’s an example of the output it generated from DBpedia.org for the FOAF ontology:

 ./RdfMetal.exe -e:http://DBpedia.org/sparql -i -n http://xmlns.com/foaf/0.1/ -o foaf.cs

Which produced the following source:

namespace Some.Namespace
{
[assembly: Ontology(
    BaseUri = "http://xmlns.com/foaf/0.1/",
    Name = "MyOntology",
    Prefix = "MyOntology",
    UrlOfOntology = "http://xmlns.com/foaf/0.1/")]

    public partial class MyOntologyDataContext : RdfDataContext
    {
        public MyOntologyDataContext(TripleStore store) : base(store)
        {
        }
        public MyOntologyDataContext(string store) : base(new TripleStore(store))
        {
        }

                public IQueryable<Person> Persons
                {
                    get
                    {
                        return ForType<Person>();
                    }
                }

                public IQueryable<Document> Documents
                {
                    get
                    {
                        return ForType<Document>();
                    }
                }

                // ...        

    }

[OwlResource(OntologyName="MyOntology", RelativeUriReference="Person")]
public partial class Person
{
  [OwlResource(OntologyName = "MyOntology", RelativeUriReference = "surname")]
  public string surname {get;set;}
  [OwlResource(OntologyName = "MyOntology", RelativeUriReference = "family_name")]
  public string family_name {get;set;}
  [OwlResource(OntologyName = "MyOntology", RelativeUriReference = "geekcode")]
  public string geekcode {get;set;}
  [OwlResource(OntologyName = "MyOntology", RelativeUriReference = "firstName")]
  public string firstName {get;set;}
  [OwlResource(OntologyName = "MyOntology", RelativeUriReference = "plan")]
  public string plan {get;set;}
  [OwlResource(OntologyName = "MyOntology", RelativeUriReference = "knows")]
  public Person knows {get;set;}
  [OwlResource(OntologyName = "MyOntology", RelativeUriReference = "img")]
  public Image img {get;set;}
  [OwlResource(OntologyName = "MyOntology", RelativeUriReference = "myersBriggs")]
  // ...
}

[OwlResource(OntologyName="MyOntology", RelativeUriReference="Document")]
public partial class Document
{
  [OwlResource(OntologyName = "MyOntology", RelativeUriReference = "primaryTopic")]
  public LinqToRdf.OwlInstanceSupertype primaryTopic {get;set;}
  [OwlResource(OntologyName = "MyOntology", RelativeUriReference = "topic")]
  public LinqToRdf.OwlInstanceSupertype topic {get;set;}
}
// ...

As you can see, it’s still pretty rough, but it allows me to write queries like this:

[TestMethod]
public void TestGetPetesFromDbPedia()
{
    var ctx = new MyOntologyDataContext("http://DBpedia.org/sparql");
    var q = from p in ctx.Persons
            where p.firstName.StartsWith("Pete")
            select p;
    foreach (Person person in q)
    {
        Debug.WriteLine(person.firstName + " " + person.family_name);
    }
}

RdfMetal will be added to the v0.8 release of LinqToRdf in the not too distant future. If you have any feature requests, or want to help out, please reply to this or better-still join the LinqToRdf discussion group and post there.

Make a Comment

Make A Comment: ( 1 so far )

blockquote and a tags work here.

One Response to “LinqToRdf v0.7.1 and RdfMetal”

RSS Feed for The Wandering Glitch Comments RSS Feed

RDFMetal is a fantatsic idea, I think it will certainly enable people to get off the ground faster, I was playing with dbpedia the other day and it was exactly the tool that I was missing! Personally i would like to see some more examples in the documentation for querying DBPedia as it seems a good starting point for lots of rich semantic example data.

[mRg]
June 9, 2008

Where's The Comment Form?

    About

    I am the wandering glitch - catch me if you can.

    RSS

    Subscribe Via RSS

    • Subscribe with Bloglines
    • Add your feed to Newsburst from CNET News.com
    • Subscribe in Google Reader
    • Add to My Yahoo!
    • Subscribe in NewsGator Online
    • The latest comments to all posts in RSS
    • Subscribe in Rojo

    Meta

Liked it here?
Why not try sites on the blogroll...