Package com.hp.hpl.jena.iri

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


  }

 
  public void testRelativizeFrag1() {
    IRIFactory f = IRIFactory.jenaImplementation();
    IRI base = f.create("http://example.org/somefolder/mybase.rdf");
    IRI frag = f.create("http://example.org#foo");
    IRI rel = base.relativize(frag);
    assertEquals(frag,rel);
//    System.err.println(rel.toString());
    IRI back = base.resolve(rel);
    assertEquals(frag,back);
  }
View Full Code Here


    assertEquals(frag,back);
  }

  public void testRelativizeFrag2() {
    IRIFactory f = IRIFactory.jenaImplementation();
    IRI base = f.create("http://example.org/somefolder/mybase.rdf");
    IRI frag = f.create("http://example.org/#foo");
    IRI rel = base.relativize(frag);
    assertEquals("/#foo",rel.toString());
    IRI back = base.resolve(rel);
    assertEquals(frag,back);
  }
View Full Code Here

    assertEquals(frag,back);
  }
 
  public void testXPointer() {
    IRIFactory f = IRIFactory.jenaImplementation();
    IRI base = f.create("http://example.org/");
    IRI frag = base.resolve("http://eg.com/test.txt#xpointer(/unit[5])");
    Iterator<Violation> it = frag.violations(false);
        assertTrue(it.hasNext()) ;

//    while (it.hasNext()) {
//      System.err.println(it.next().getLongMessage());
//    }
View Full Code Here

//    }
   
  }
  public void testNotIDN() {
    IRIFactory f = IRIFactory.jenaImplementation();
    IRI base = f.create("http://example.org/");
    IRI frag = base.resolve("outbind://4-00000000C45F478BF9F2A048A7A59DE"+
        "3AE35F7230700D3E3AEE226D20A49A390BCD779EC5D4700"+
        "00003DB3650000D3E3AEE226D20A49A390BCD779EC5D470"+
          "00001182DB0000/www.uconnectevent.org");
    Iterator <Violation>it = frag.violations(false);
    assertTrue(it.hasNext()) ;
   
//    while (it.hasNext()) {
//      System.err.println(it.next().getLongMessage());
//    }
View Full Code Here

        super("relativize"+ (++count),att,suite);
    }

    @Override
    IRI computeIRI() {
        IRI base = ((TestMoreExamples)parent.testAt(0)).getIRI();
        IRI rel = ((TestMoreExamples)parent.testAt(2)).getIRI();
        return base.relativize(rel, TestCreator.RelativizeFlags);
    }
View Full Code Here

        super("result"+ (++count),att, suite);
    }

    @Override
    IRI computeIRI() {
        IRI base = ((TestMoreExamples)parent.testAt(0)).getIRI();
        IRI rel = ((TestMoreExamples)parent.testAt(1)).getIRI();
        return base.create(rel);
    }
View Full Code Here

        IRIFactory f =
            specs[specID].isSchemeSpec()?
                    IRIFactory.iriImplementation():
                    all[specID][Force.MUST];
       
        IRI iri = f.create(uri);
        if (iri.hasViolation(false)) {
            if (good) fail("Unexpected violation found: "+
            ((iri.violations(false).next())).codeName()
           
            );
        } else {
            if (!good) fail("Expected a violation, none found.");
        }
View Full Code Here

    }

    private void runTest(IRIFactory f, boolean expectError,
            boolean expectWarning, String desc) {
        IRI iri = f.create(uri);
        boolean implemented = violation.isImplemented();
        expectError = expectError && implemented;
        expectWarning = expectWarning && (!expectError) && implemented;
        if (good) {
            expectError = expectWarning = false;
        }
        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)
View Full Code Here

    static public IRIFactory f = IRIFactory.jenaImplementation();
  
    @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

    private static Property property(String localname) { return ResourceFactory.createProperty(iri(localname)) ; }
       
    private static String iri(String localname)
    {
        String uri = NS+localname ;
        IRI iri = IRIResolver.parseIRI(uri) ;
        if ( iri.hasViolation(true) )
            throw new FusekiException("Bad IRI: "+iri) ;
        if ( ! iri.isAbsolute() )
            throw new FusekiException("Bad IRI: "+iri) ;
       
        return uri ;
    }
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.