質問
私は最近、Rowlex を使用したセマンティック Web アプリケーション プロジェクトに取り組んでいます。いくつかの機能ニーズに達しましたが、それらに適切なメソッドを適合させることができませんでした。誰かが私を助けてくれないかと思っていました。
- 新しい RDF ドキュメントを作成していますが、最後に、入力された rdfdocument を保存する方法がわかりません。
- 既存のrdfに新規個体を作成しているのですが、最終的にrdfを保存する方法が分かりません。AddIndividual メソッドは、uri と type を受け入れます。どうすれば彼らと協力できるでしょうか?
- 個人を削除したいのですが、方法がわかりません。
- 個々のプロパティを追加、削除、または編集したい
Rowlex メソッドを説明できるガイド文書はありますか?
よろしくお願いします
解決
1)保存: あなたのRdfDocumentを永続化するさまざまな方法があります。 RDF / XMLまたはN3:あなたは形式上の2つの選択肢があります。あなたの選択に基づいて、あなたは、任意の以下のメソッドを呼び出すことができます:
RdfDocument rdfDoc = new RdfDocument();
// Populate the document with new individual
// ...
// Alternatives to save the document
XmlDocument xml = rdfDoc.ExportToRdfXml();
xml.Save("C:\\myRdfDoc.rdf");
// or
rdfDoc.ExportToRdfXml("C:\\myRdfDoc.rdf");
// or
rdfDoc.ExportToN3("C:\\myRdfDoc.rdf");
// or
string n3 = rdfDoc.ToN3();
string rdfXml = rdfDoc.ToRdfXml();
// and save the strings into a text file yourself
理解することが重要です:あなたは常にあなたの全体のRDFグラフを表すRDFドキュメントを保存します。あなたは個人を保存しない!
2)RdfDocumentから個々の取り外し
RdfDocument rdfDoc = new RdfDocument();
// Let us assume that you have an ROWLEX generated class called "Car"
// Let us create a Car individual first, then remove it.
Car car = new Car("ABC-123", rdfDoc); // added
rdfDoc.RemoveIndividual(car); // removed
3)の追加/削除/編集プロパティ
Car car = new Car("ABC-123", rdfDoc);
// We inject a new triple into the document by this
car.LastMaintenance = new DateTime(2008,04,18);
// Editing the property:
car.LastMaintenance = new DateTime(2009,05,11);
// For removing, you need to use the full-version of
// the generated class instead of the light-version:
Car_ sameCar = rdfDocument.GetIndividual(car.ID, Car.Uri, false) as Car_;
sameCar.RemoveLastMainenance(sameCar.LastMaintenance);
所属していません StackOverflow