?? strawmantoms10.java
字號:
package edu.stanford.db.rdf.examples;import org.w3c.rdf.model.*;import org.w3c.rdf.util.*;import org.w3c.rdf.implementation.model.ModelImpl;import org.w3c.rdf.implementation.syntax.sirpac.SiRS;import edu.stanford.db.rdf.syntax.strawman.StrawmanParser;import org.xml.sax.SAXException;/** * A simple demo program that parses RDF in the strawman syntax at a given URL, * serializes it back into RDF/XML, and dumps the triples. * * <p>Try <code>java org.w3c.rdf.examples.StrawmanToMS10 http://www-db.stanford.edu/~melnik/rdf/examples/data.xml</code> */public class StrawmanToMS10 { static void bailOut() { System.err.println("Usage: StrawmanToMS10 [-d] <URL | file name>\n" + "Option -d turns on digest generation for unnamed resources.\n" + "Use JVM option -Dorg.xml.sax.parser=<classname> to replace default XML parser."); System.exit(1); } public static void main (String args[]) throws Exception { boolean useDigests = false; String fileOrURI = null; for(int i = 0; i < args.length; i++) { String a = args[i]; if(a.startsWith("-d")) useDigests = true; else { fileOrURI = a; if(i+1 < args.length) bailOut(); } } if(fileOrURI == null) bailOut(); Model m = new ModelImpl(); try { RDFUtil.parse(fileOrURI, new StrawmanParser(useDigests, true), m); } catch (SAXException se) { System.err.println("Exception during parsing: " + se.getMessage()); throw se.getException(); } System.err.println("\nSERIALIZED MODEL:\n"); RDFUtil.dumpModel(m, System.out, new SiRS()); System.err.println("\nTRIPLES:\n"); RDFUtil.printStatements(m, System.out); System.err.println("\nModel " + m.getURI() + " of size " + m.size() + "\n"); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -