문제

저는 최근 Rowlex를 사용하여 시맨틱 웹 응용 프로그램 프로젝트를 진행하고 있습니다. 적절한 방법을 일치시킬 수없는 몇 가지 기능 요구에 도달했습니다. 누군가가 나를 도울 것인지 궁금합니다.

  • 새로운 RDF 문서를 만들고 있지만 결국 인구가 많은 RDFDocument를 저장하는 방법을 모르겠습니다.
  • 기존 RDF에서 새로운 개인을 만들고 있지만 마침내 RDF를 저장하는 방법을 모르겠습니다. Addindividual 메소드는 URI 및 유형을 수락합니다. 그들과 어떻게 일할 수 있습니까?
  • 나는 개인을 제거하고 싶고 방법을 모릅니다.
  • 개별 속성을 추가, 제거 또는 편집하고 싶습니다.

Rowlex 방법을 설명 할 수있는 안내서가 있습니까?

미리 감사드립니다

도움이 되었습니까?

해결책

1) 저장 : RDFDocument를 지속하는 다양한 방법이 있습니다. RDF/XML 또는 N3 형식의 두 가지 선택이 있습니다. 선택에 따라 다음 방법을 호출 할 수 있습니다.

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);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top