我的耶拿图书馆的写作方法有问题。我有以下代码应该将输出写入外部文件,但它没有这样做。
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 = "brian_mcbride@hp.com";
static String briansEmail2 = "brian_mcbride@hpl.hp.com";
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");
}
}