001: /*
002: (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
003: [See end of file]
004: $Id: rdfparse.java,v 1.10 2008/01/02 12:08:16 andy_seaborne Exp $
005: */
006:
007: package jena;
008:
009: import java.lang.reflect.Constructor;
010:
011: import com.hp.hpl.jena.rdf.arp.NTriple;
012: import com.hp.hpl.jena.shared.Command;
013:
014: /** A command line interface into ARP.
015: * Creates NTriple's or just error messages.
016: * <pre>
017: * java <class-path> jena.rdfparse ( [ -[xstfu]][ -b xmlBase -[eiw] NNN[,NNN...] ] [ file ] [ url ] )...
018: *
019: * java <class-path> jena.rdfparse --test
020: *
021: * java <class-path> jena.rdfparse --internal-test
022: * </pre>
023: *
024: * <p>
025: * The last two forms are for testing. <code>--test</code> runs ARP
026: * against the RDF Core Working Group tests found at w3.org.
027: * <code>--internal-test</code> uses a cached copy from within the jena.jar.
028: * </p>
029: * All options, files and URLs can be intemingled in any order.
030: * They are processed from left-to-right.
031: * <dl>
032: * file </dt><dd> Converts (embedded) RDF in XML file into N-triples
033: * </dd><dt>
034: * url </dt><dd> Converts (embedded) RDF from URL into N-triples
035: * </dd><dt>
036: * -b uri </dt><dd> Sets XML Base to the absolute URI.
037: * </dd><dt>
038: * -r </dt><dd> Content is RDF (no embedding, rdf:RDF tag may be omitted).
039: * </dd><dt>
040: * -t </dt><dd> No n-triple output, error checking only.
041: * </dd><dt>
042: * -x </dt><dd> Lax mode - warnings are suppressed.
043: * </dd><dt>
044: * -s </dt><dd> Strict mode - most warnings are errors.
045: * </dd><dt>
046: * -u </dt><dd> Allow unqualified attributes (defaults to warning).
047: * </dd><dt>
048: * -f </dt><dd> All errors are fatal - report first one only.
049: * </dd><dt>
050: * -b url </dt><dd> Sets XML Base to the absolute url.
051: * </dd><dt>
052: * -e NNN[,NNN...]</dt><dd>
053: * Treats numbered warning conditions as errrors.
054: * </dd><dt>
055: * -w NNN[,NNN...]</dt><dd>
056: * Treats numbered error conditions as warnings.
057: * </dd><dt>
058: * -i NNN[,NNN...]
059: * </dt><dd>
060: * Ignores numbered error/warning conditions.
061: * </dl>
062: * @author jjc
063: */
064:
065: public class rdfparse {
066:
067: /** Either start an RDF/XML to NTriple converter, or run test suite.
068: * @param args The command-line arguments.
069: */
070: public static void main(String[] args) throws Exception {
071: if (args.length == 1
072: && (args[0].equals("--test") || args[0]
073: .equals("--internal-test")))
074: runTests(args[0].equals("--test"));
075: else
076: NTriple.main(args);
077: }
078:
079: /**
080: wrapped this way so JUnit not a compile-time requirement.
081: */
082: protected static void runTests(boolean internetTest)
083: throws Exception {
084: Class rdfparse = Class.forName("jena.test.rdfparse");
085: Constructor constructor = rdfparse
086: .getConstructor(new Class[] { boolean.class });
087: Command c = (Command) constructor
088: .newInstance(new Object[] { new Boolean(internetTest) });
089: c.execute();
090: // ARPTests.internet = internetTest;
091: // TestRunner.main( new String[] { "-noloading", ARPTests.class.getName()});
092: }
093: }
094:
095: /*
096: (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
097: All rights reserved.
098:
099: Redistribution and use in source and binary forms, with or without
100: modification, are permitted provided that the following conditions
101: are met:
102:
103: 1. Redistributions of source code must retain the above copyright
104: notice, this list of conditions and the following disclaimer.
105:
106: 2. Redistributions in binary form must reproduce the above copyright
107: notice, this list of conditions and the following disclaimer in the
108: documentation and/or other materials provided with the distribution.
109:
110: 3. The name of the author may not be used to endorse or promote products
111: derived from this software without specific prior written permission.
112:
113: THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
114: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
115: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
116: IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
117: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
118: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
119: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
120: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
121: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
122: THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
123: */
|