1
我遇到與我的jena庫的寫入方法有關的問題。 我有下面這段代碼應該寫在外部文件的輸出,但它不這樣做。Jena庫不會將輸出寫入外部RDF/XML文件
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.vocabulary.*;
import com.hp.hpl.jena.rdf.model.impl.ModelCom;
public class Tutorial04 extends Object {
// some definitions
static String tutorialURI = "http://hostname/rdf/tutorial/";
static String briansName = "Brian McBride";
static String briansEmail1 = "[email protected]";
static String briansEmail2 = "[email protected]";
static String title = "An Introduction to RDF and the Jena API";
static String date = "23/01/2001";
@SuppressWarnings("unused")
public static void main (String args[]) {
// some definitions
String personURI = "http://somewhere/JohnSmith";
String givenName = "John";
String familyName = "Smith";
String fullName = givenName + " " + familyName;
// create an empty model
Model model = ModelFactory.createDefaultModel();
// create the resource
// and add the properties cascading style
Resource johnSmith
= model.createResource(personURI)
.addProperty(VCARD.FN, fullName)
.addProperty(VCARD.N,
model.createResource()
.addProperty(VCARD.Given, givenName)
.addProperty(VCARD.Family, familyName));
// now write the model in XML form to a file
// model.write(System.out, "RDF/XML");
model.write(System.out,"RDF/XML");
}
}
謝謝Ian :)它有幫助。 另外,我會在我的最後一年的項目中需要你一些更多的幫助。你還有耶拿圖書館的專門知識嗎? –
很高興有幫助。如果您需要Jena的其他幫助,您可以繼續在此處提問或向Jenu用戶組發送消息:請參閱http://jena.apache.org/help_and_support/index.html –
Hi Ian。我可以有你的電子郵件地址嗎? 本週,我將需要幫助在jena的一些任務 –