Search in sources :

Example 41 with Lang

use of org.apache.jena.riot.Lang 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

Lang (org.apache.jena.riot.Lang)41 InputStream (java.io.InputStream)10 CmdException (jena.cmd.CmdException)8 IOException (java.io.IOException)6 Model (org.apache.jena.rdf.model.Model)6 ByteArrayInputStream (java.io.ByteArrayInputStream)5 GZIPInputStream (java.util.zip.GZIPInputStream)4 ServletOutputStream (javax.servlet.ServletOutputStream)4 ContentType (org.apache.jena.atlas.web.ContentType)4 MediaType (org.apache.jena.atlas.web.MediaType)4 RiotException (org.apache.jena.riot.RiotException)4 Dataset (org.apache.jena.query.Dataset)3 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)3 ArrayList (java.util.ArrayList)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 HttpServletResponse (javax.servlet.http.HttpServletResponse)2 FileItemIterator (org.apache.commons.fileupload.FileItemIterator)2 FileItemStream (org.apache.commons.fileupload.FileItemStream)2 ServletFileUpload (org.apache.commons.fileupload.servlet.ServletFileUpload)2 BaseTest (org.apache.jena.atlas.junit.BaseTest)2