Search in sources :

Example 51 with IRI

use of org.apache.jena.iri.IRI in project jena by apache.

the class ModLangParse method processArgs.

@Override
public void processArgs(CmdArgModule cmdLine) {
    if (cmdLine.contains(argValidate)) {
        validate = true;
        strict = true;
        explicitCheck = true;
        bitbucket = true;
    }
    if (cmdLine.contains(argSyntax)) {
        String syntax = cmdLine.getValue(argSyntax);
        Lang lang$ = RDFLanguages.nameToLang(syntax);
        if (lang$ == null)
            throw new CmdException("Can not detemine the syntax from '" + syntax + "'");
        this.lang = lang$;
    }
    if (cmdLine.contains(argCheck))
        explicitCheck = true;
    if (cmdLine.contains(argNoCheck))
        explicitNoCheck = true;
    if (cmdLine.contains(argStrict))
        strict = true;
    if (cmdLine.contains(argSkip))
        skipOnBadTerm = true;
    if (cmdLine.contains(argNoSkip))
        skipOnBadTerm = false;
    if (cmdLine.contains(argBase)) {
        baseIRI = cmdLine.getValue(argBase);
        IRI iri = IRIResolver.resolveIRI(baseIRI);
        if (iri.hasViolation(false))
            throw new CmdException("Bad base IRI: " + baseIRI);
        if (!iri.isAbsolute())
            throw new CmdException("Base IRI must be an absolute IRI: " + baseIRI);
    }
    if (cmdLine.contains(argStop))
        stopOnBadTerm = true;
    if (cmdLine.contains(argSink))
        bitbucket = true;
    if (cmdLine.contains(argRDFS)) {
        try {
            rdfsVocabFilename = cmdLine.getArg(argRDFS).getValue();
            rdfsVocab = FileManager.get().loadModel(rdfsVocabFilename);
        } catch (RiotException ex) {
            throw new CmdException("Error in RDFS vocabulary: " + rdfsVocabFilename);
        } catch (Exception ex) {
            throw new CmdException("Error: " + ex.getMessage());
        }
    }
}
Also used : IRI(org.apache.jena.iri.IRI) RiotException(org.apache.jena.riot.RiotException) CmdException(jena.cmd.CmdException) Lang(org.apache.jena.riot.Lang) RiotException(org.apache.jena.riot.RiotException) CmdException(jena.cmd.CmdException)

Aggregations

IRI (org.apache.jena.iri.IRI)51 Violation (org.apache.jena.iri.Violation)12 IRIFactory (org.apache.jena.iri.IRIFactory)9 IOException (java.io.IOException)3 Node (org.apache.jena.graph.Node)3 Test (org.junit.Test)3 PrintStream (java.io.PrintStream)2 MalformedURLException (java.net.MalformedURLException)2 ServletOutputStream (javax.servlet.ServletOutputStream)2 Lang (org.apache.jena.riot.Lang)2 RiotException (org.apache.jena.riot.RiotException)2 CheckerIRI (org.apache.jena.riot.checker.CheckerIRI)2 IRI (org.apache.jena.riot.tokens.TokenType.IRI)2 InputStream (java.io.InputStream)1 BigDecimal (java.math.BigDecimal)1 URI (java.net.URI)1 URL (java.net.URL)1 Date (java.sql.Date)1 SQLException (java.sql.SQLException)1 Time (java.sql.Time)1