Search in sources :

Example 11 with IRIFactory

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

the class MoreTests method testXPointer.

public void testXPointer() {
    @SuppressWarnings("deprecation") 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());
//		}
}
Also used : Violation(org.apache.jena.iri.Violation) IRI(org.apache.jena.iri.IRI) IRIFactory(org.apache.jena.iri.IRIFactory)

Example 12 with IRIFactory

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

the class TestExample method runTestJustSpec.

private void runTestJustSpec() {
    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.");
    }
}
Also used : IRI(org.apache.jena.iri.IRI) IRIFactory(org.apache.jena.iri.IRIFactory)

Example 13 with IRIFactory

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

the class TestExample method runTestErrorCode.

private void runTestErrorCode() {
    IRIFactory f = new IRIFactory();
    f.setIsError(violation.getCode(), true);
    runTest(f, true, false, "Just this error");
}
Also used : IRIFactory(org.apache.jena.iri.IRIFactory)

Example 14 with IRIFactory

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

the class iri method main.

public static void main(String[] args) {
    //IRIFactory iriFactory = IRIFactory.iriImplementation() ;
    IRIFactory iriFactory = IRIResolver.iriFactory;
    boolean first = true;
    for (String iriStr : args) {
        if (iriStr.startsWith("<") && iriStr.endsWith(">"))
            iriStr = iriStr.substring(1, iriStr.length() - 1);
        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());
        }
    }
}
Also used : Violation(org.apache.jena.iri.Violation) IRI(org.apache.jena.iri.IRI) IRIFactory(org.apache.jena.iri.IRIFactory)

Example 15 with IRIFactory

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

the class iri method main.

public static void main(String... args) {
    IRIFactory iriFactory = SetupJenaIRI.iriCheckerFactory();
    boolean first = true;
    for (String iriStr : args) {
        if (iriStr.startsWith("<") && iriStr.endsWith(">"))
            iriStr = iriStr.substring(1, iriStr.length() - 1);
        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());
        }
    }
}
Also used : Violation(org.apache.jena.iri.Violation) SetupJenaIRI(org.apache.jena.irix.SetupJenaIRI) IRI(org.apache.jena.iri.IRI) IRIFactory(org.apache.jena.iri.IRIFactory)

Aggregations

IRIFactory (org.apache.jena.iri.IRIFactory)15 IRI (org.apache.jena.iri.IRI)10 Violation (org.apache.jena.iri.Violation)4 Test (org.junit.Test)3 Model (org.apache.jena.rdf.model.Model)2 Graph (org.apache.jena.graph.Graph)1 SetupJenaIRI (org.apache.jena.irix.SetupJenaIRI)1 Property (org.apache.jena.rdf.model.Property)1 RDFReaderI (org.apache.jena.rdf.model.RDFReaderI)1 Resource (org.apache.jena.rdf.model.Resource)1 Statement (org.apache.jena.rdf.model.Statement)1 UnknownPropertyException (org.apache.jena.shared.UnknownPropertyException)1