Package com.hp.hpl.jena.iri

Examples of com.hp.hpl.jena.iri.IRI


    }

    protected final void directiveBase()
    {
        String baseStr = peekToken().getImage() ;
        IRI baseIRI = profile.makeIRI(baseStr, currLine, currCol) ;
        nextToken() ;
       
        expect("Base directive not terminated by a dot", DOT) ;
        profile.getPrologue().setBaseURI(baseIRI) ;
    }
View Full Code Here


            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 ;
View Full Code Here

        // Simple literal or xsd:string
        String str = simpleLiteralOrXSDString(nv) ;
        if  (str == null )
            throw new ExprEvalException("Can't make an IRI from "+nv) ;

        IRI iri = null ;
        String iriStr = nv.getLiteralLexicalForm() ;
           
        // Level of checking?
        if ( baseIRI != null )
        {
            IRI base = iriFactory.create(baseIRI);
            iri = base.create(iriStr);
        }
        else
            iri = iriFactory.create(iriStr);

        if ( ! iri.isAbsolute() )
View Full Code Here

        }

    }

    private void check(String string) {
        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 {
View Full Code Here

            String prefix = peekToken().getImage() ;
            nextToken() ;
            if ( ! lookingAt(IRI) )
                exception(peekToken(), "@prefix requires an IRI (found '"+peekToken()+"')") ;
            String iriStr = peekToken().getImage() ;
            IRI iri = profile.makeIRI(iriStr, currLine, currCol) ;
            profile.getPrologue().getPrefixMap().add(prefix, iri) ;
            nextToken() ;
            expect("PREFIX directive not terminated by a dot", DOT) ;
        }
View Full Code Here

        {
            if ( ! first )
                System.out.println() ;
            first = false ;
           
            IRI iri = iriFactory.create(iriStr) ;
            System.out.println(iriStr + " ==> "+iri) ;
            if ( iri.isRelative() )
                System.out.println("Relative: "+iri.isRelative()) ;

            Iterator<Violation> vIter = iri.violations(true) ;
            for ( ; vIter.hasNext() ; )
            {
                System.out.println(vIter.next().getShortMessage()) ;
            }
        }
View Full Code Here

                return;
            IRIImpl iri = (IRIImpl) factory.create(s);
            show(iri);

            if (last != null) {
                IRI r = last.create(iri);
                System.out.println("Resolved: " + r.toString());
                show(r);
            }
            last = iri;
        }
    }
View Full Code Here

   
    static public String abbrevByBase(String uri, String base)
    {
        if ( hasScheme(uri) )
            return uri ;
        IRI baseIRI = IRIFactory.jenaImplementation().construct(base) ;
        IRI rel = baseIRI.relativize(uri, relFlags) ;
        String r = rel.toString() ;
        return r ;
    }
View Full Code Here

    /** Add a prefix, overwites any existing association */
    public void add(String prefix, String iriString)
    {
        prefix = canonicalPrefix(prefix) ;
        IRI iri = IRIFactory.iriImplementation().create(iriString) ;
        // Check!
        prefixes.put(prefix, iri);
    }
View Full Code Here

   
    /** Expand a prefix, return null if it can't be expanded */
    public String expand(String prefix, String localName)
    {
        prefix = canonicalPrefix(prefix) ;
        IRI x = prefixes.get(prefix) ;
        if ( x == null )
            return null ;
        return x.toString()+localName ;
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.iri.IRI

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.