|  | 
 
| http://razor.occams.info/code/semweb/ 以上的link有c#处理rdf的库,owl的处理的话,把owl当成rdf就可以了,虽然效率不是很好,终究还是可用的咚咚,不知道各位还知道有其他C#的Owl库没,请赐教。
 
 我还用过其他一些 比如 drive rdf .net 和 EulerSharp 和Jena.net 不过觉得不太好用,用过这些的朋友们也请交换点意见如何?
 
 
 复制代码
// This example creates a few RDF statements and adds
// them to a MemoryStore.  Then it writes out the
// statements in RDF/XML format to the console.  Note
// that the implicit string-to-Entity and string-to-
// Literal conversion operators are being used.
using System;
using SemWeb;
public class Example {
    const string RDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
    public static void Main() {
        //建立一个留内存处理区域
        MemoryStore store = new MemoryStore();
        
        //这一点由于采用了RDF的概念,和OWL的jena编程有所不同,把所有的element and properity都声明为Entity
        Entity computer = new Entity("http://example.org/computer");
        Entity says = "http://example.org/says";
        Entity wants = "http://example.org/wants";
        Entity desire = new BNode();
        Entity description = new Entity("http://example.org/description");
        
        //在刚才声明的store中按照RDF的三元方式添加Statement: the subject is the URL, computer 
        //the predicate is the word says the object is the phrase (Literal)"Hello world!"
 
        store.Add(new Statement(computer, says, (Literal)"Hello world!"));
        store.Add(new Statement(computer, wants, desire));
        store.Add(new Statement(desire, description, (Literal)"to be human"));
        store.Add(new Statement(desire, RDF+"type", (Entity)"http://example.org/Desire"));
        
        //输出结果
        using (RdfWriter writer = new RdfXmlWriter(Console.Out)) {
            writer.Namespaces.AddNamespace("http://example.org/", "ex");
            writer.Write(store);
        }
    }
}
[ 本帖最后由 smallpotato 于 2007-5-12 15:45 编辑 ]
 | 
 |