?? rdfgenerator.java
字號:
import com.hp.hpl.mesa.rdf.jena.mem.ModelMem;
import com.hp.hpl.mesa.rdf.jena.model.*;
import com.hp.hpl.mesa.rdf.jena.vocabulary.*;
import java.io.FileOutputStream;
import java.io.PrintWriter;
public class RDFGenerator extends Object {
public static void main(String[] args) {
//some definitions
String personURI = "http://somewhere/JohnSmith";
String givenName = "John";
String familyName = "Smith";
String fullName = givenName + " " + familyName;
try {
//create an empty graph
Model model = new ModelMem();
//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(new PrintWriter(System.out));
} catch (Exception e) {
System.out.println("Failed : " + e);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -