Package org.apache.jena.iri

Examples of org.apache.jena.iri.Violation


            throw new ExprEvalException("Relative IRI string: " + iriStr) ;
        if ( warningsForIRIs && iri.hasViolation(false) ) {
            String msg = "unknown violation from IRI library" ;
            Iterator<Violation> iter = iri.violations(false) ;
            if ( iter.hasNext() ) {
                Violation viol = iter.next() ;
                msg = viol.getShortMessage() ;
            }
            Log.warn(NodeFunctions.class, "Bad IRI: " + msg + ": " + iri) ;
        }
        return NodeFactory.createURI(iri.toString()) ;
    }
View Full Code Here


           
            boolean errorSeen = false ;
            boolean warningSeen = false ;
           
            // What to finally report.
            Violation vError = null ;
            Violation vWarning = null ;
            Violation xvSub = null ;
           
            for ( ; iter.hasNext() ; )
            {
                Violation v = iter.next();
                int code = v.getViolationCode() ;
                boolean isError = v.isError() ;
               
                // Ignore these.
                if ( code == Violation.LOWERCASE_PREFERRED
                    ||
                    code == Violation.PERCENT_ENCODING_SHOULD_BE_UPPERCASE
                    ||
                    code == Violation.SCHEME_PATTERN_MATCH_FAILED
                    )
                    continue ;

                // Anything we want to reprioritise?
                // [nothing at present]
               
                // Remember first error and first warning.
                if ( isError )
                {
                    errorSeen = true ;
                    if ( vError == null )
                        // Remember first error
                        vError = v ;
                }
                else
                {
                    warningSeen = true ;
                    if ( vWarning == null )
                        vWarning = v ;
                }
               
                String msg = v.getShortMessage();
                String iriStr = iri.toString();

                // Ideally, we might want to output all messages relating to this IRI
                // then cause the error or continue.
                // But that's tricky given the current errorhandler architecture.
View Full Code Here

        {
            String msg = "unknown violation from IRI library" ;
            Iterator<Violation> iter = iri.violations(false) ;
            if ( iter.hasNext() )
            {
                Violation viol = iter.next() ;
                msg = viol.getShortMessage() ;
            }
            Log.warn(NodeFunctions.class, "Bad IRI: "+msg+": "+iri) ;
        }
        return NodeFactory.createURI(iri.toString()) ;
    }
View Full Code Here

        IRI iri = factory.create(string);
        if (iri.hasViolation(true)) {
            System.out.println("n: " + string);
            Iterator<Violation> it = iri.violations(true);
            while (it.hasNext()) {
                Violation v = it.next();
                System.out.println(v.getLongMessage());
            }
        } else {
            System.out.println("y: " + string);
        }
    }
View Full Code Here

           
            boolean errorSeen = false ;
            boolean warningSeen = false ;
           
            // What to finally report.
            Violation vError = null ;
            Violation vWarning = null ;
            Violation xvSub = null ;
           
            for ( ; iter.hasNext() ; )
            {
                Violation v = iter.next();
                int code = v.getViolationCode() ;
                boolean isError = v.isError() ;
               
                // Ignore these.
                if ( code == Violation.LOWERCASE_PREFERRED
                    ||
                    code == Violation.PERCENT_ENCODING_SHOULD_BE_UPPERCASE
                    ||
                    code == Violation.SCHEME_PATTERN_MATCH_FAILED
                    )
                    continue ;

                // Anything we want to reprioritise?
                // [nothing at present]
               
                // Remember first error and first warning.
                if ( isError )
                {
                    errorSeen = true ;
                    if ( vError == null )
                        // Remember first error
                        vError = v ;
                }
                else
                {
                    warningSeen = true ;
                    if ( vWarning == null )
                        vWarning = v ;
                }
               
                String msg = v.getShortMessage();
                String iriStr = iri.toString();

                // Ideally, we might want to output all messages relating to this IRI
                // then cause the error or continue.
                // But that's tricky given the current errorhandler architecture.
View Full Code Here

    @Override
    public void runTest() {
        IRI iri = f.create(uri);
        Iterator<Violation> it = iri.violations(true);
        while (it.hasNext()) {
            Violation v = it.next();
            printErrorMessages(v);
           
        }
    }
View Full Code Here

        }
        boolean hasError = false;
        boolean hasWarning = false;
        Iterator<Violation> it = iri.violations(true);
        while (it.hasNext()) {
            Violation v = it.next();
            if (v.getViolationCode() == violation.getCode()) {
                if (v.isError()) {
                    if (!expectError)
                        fail("Unexpected error, "+desc);
                    hasError = true;
                } else {
                    if (!expectWarning)
View Full Code Here

        }
        boolean hasError = false;
        boolean hasWarning = false;
        Iterator<Violation> it = iri.violations(true);
        while (it.hasNext()) {
            Violation v = it.next();
            if (v.getViolationCode() == violation.getCode()) {
                if (v.isError()) {
                    if (!expectError)
                        fail("Unexpected error, "+desc);
                    hasError = true;
                } else {
                    if (!expectWarning)
View Full Code Here

    @Override
    public void runTest() {
        IRI iri = f.create(uri);
        Iterator<Violation> it = iri.violations(true);
        while (it.hasNext()) {
            Violation v = it.next();
            printErrorMessages(v);
           
        }
    }
View Full Code Here

    {
        IRI iri = IRIFactory.iriImplementation().create(s) ;
        System.out.println(">> "+iri) ;
        for ( Iterator<Violation> iter = iri.violations(true) ; iter.hasNext() ; )
        {
            Violation v = iter.next();
            System.out.println(v.getShortMessage()) ;
        }
        System.out.println("<< "+iri) ;
        System.out.println() ;
    }
View Full Code Here

TOP

Related Classes of org.apache.jena.iri.Violation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.