Package com.hp.hpl.jena.ontology

Examples of com.hp.hpl.jena.ontology.OntModel


        assertIsoModels( itemModel( expected, statement( "a P b" ) ), r.model() );
        }
   
    @Test public void testReportsFirstlessListOnSubsequentElement()
        {
        OntModel om = ontModel( "a P b; b rdf:first X & rdf:rest c; c rdf:rest rdf:nil" );
        ins.inspectList( r, statement( "a P b"), resource( om, "b" ) );
        String expected =
            "[eye:mainProperty eye:illFormedList & eye:illFormedList c"
            + " & eye:because [eye:element 2 & eye:hasNoFirst c]] rdf:type eye:Item";
        assertIsoModels( itemModel( expected, statement( "a P b" ) ), r.model() );
View Full Code Here


        assertIsoModels( itemModel( expected, statement( "a P b" ) ), r.model() );
        }

    @Test public void testReportsRestlessList()
        {
        OntModel om = ontModel( "a P b; b rdf:first F" );
        ins.inspectList( r, statement( "a P b"), resource( om, "b" ) );
        String expected =
            "[eye:mainProperty eye:illFormedList & eye:illFormedList b"
            + " & eye:because [eye:element 1 & eye:hasNoRest b]] rdf:type eye:Item";
        assertIsoModels( itemModel( expected, statement( "a P b" ) ), r.model() );
View Full Code Here

        assertIsoModels( itemModel( expected, statement( "a P b" ) ), r.model() );
        }
   
    @Test public void testReportsMultipleRestsList()
        {
        OntModel om = ontModel( "a P b; b rdf:first F & rdf:rest A & rdf:rest B" );
        ins.inspectList( r, statement( "a P b"), resource( om, "b" ) );
        String expected =
            "[eye:mainProperty eye:illFormedList & eye:illFormedList b"
            + " & eye:because [eye:element 1 & eye:hasMultipleRests b]] rdf:type eye:Item";
        assertIsoModels( itemModel( expected, statement( "a P b" ) ), r.model() );
View Full Code Here

        assertIsoModels( itemModel( expected, statement( "a P b" ) ), r.model() );
        }
   
    @Test public void testReportsTypeElementFailure()
        {
        OntModel om = ontModel( "a P b; b rdf:first F & rdf:rest rdf:nil" );
        Resource LT = resource( "LT" ), T = resource( "T" );
        ins.getIdiomaticListTypes().put( LT, T );
        ins.inspectList( r, statement( "a P b"), resource( om, "b" ), resource( "T" ) );
        String expected =
            "[eye:mainProperty eye:illTypedListElement & eye:illTypedListElement b"
View Full Code Here

        assertEquals( listOfStrings( "eh:/S eh:/P eh:/O" ), uris );
        }
   
    @Test public void testNoAssumptionsCreatesBuiltinNamespaceTable()
        {
        OntModel assume = ontModel();
        ins.begin( new Report(), assume );
        assertEquals( builtinNamespaces(), ins.map.keySet() );
        }
View Full Code Here

        return result;
        }

    @Test public void testAssumptionsFillNamespaceTable()
        {
        OntModel assume = ontModel( "ex:/A/x ex:/A/p ex:/B/y" );
        ins.begin( new Report(), assume );
        assertEquals( setOfStrings( "x p" ), ins.map.get( "ex:/A/" ) );
        assertEquals( setOfStrings( "y" ), ins.map.get( "ex:/B/" ) );
        }
View Full Code Here

        assertEquals( setOfStrings( "y" ), ins.map.get( "ex:/B/" ) );
        }
   
    @Test public void testSubmodelsFillNamespaceTable()
        {
        OntModel model = ontModel();
        Model subModel = model( "ex:/A/x ex:/A/p ex:/B/y" );
        model.addSubModel( subModel );
        ins.inspectModel( new Report(), model );
        assertEquals( setOfStrings( "x p" ), ins.map.get( "ex:/A/" ) );
        assertEquals( setOfStrings( "y" ), ins.map.get( "ex:/B/" ) );
        }
View Full Code Here

        assertEquals( setOfStrings( "y" ), ins.map.get( "ex:/B/" ) );
        }
   
    @Test public void testBothAssumptionsAndModelsFillNamespaceTable()
        {
        OntModel model = ontModel();
        model.addSubModel( model( "ex:/A/x ex:/A/p ex:/B/y" ) );
        ins.begin( new Report(), ontModel( "ex:/C/a ex:/D/q ex:/C/b" ) );
        ins.inspectModel( new Report(), model );
        assertEquals( setOfStrings( "x p" ), ins.map.get( "ex:/A/" ) );
        assertEquals( setOfStrings( "y" ), ins.map.get( "ex:/B/" ) );
        assertEquals( setOfStrings( "a b" ), ins.map.get( "ex:/C/" ) );
View Full Code Here

        assertIsoModels( wanted, r.model() );
        }
   
    @Test public void testDuplicatedURIGeneratesOnlyOneReport()
        {
        OntModel assume = ontModel( "X P Y" );
        ins.begin( r, assume );
        ins.inspectURI( r, S, resource( "Z" ) );
        ins.inspectURI( r, S, resource( "Z" ) );
        Model wanted = wanted( "[eye:mainProperty eye:notFromSchema & eye:notFromSchema 'eh:/' & eye:onResource eh:/Z]" );
        assertIsoModels( wanted, r.model() );
View Full Code Here

        }
   
    @Test public void testDoesNotReportOpenNamespace()
        {
        Resource root = resourceInModel( "root eye:openNamespace open:/" );
        OntModel assume = ontModel( "open:/cabbage P Y" );
        VocabularyInspector ins = new VocabularyInspector( root );
        ins.begin( r, assume );
        ins.inspectURI( r, S, resource( "open:/rhubarb" ) );
        assertIsoModels( model(), r.model() );
        }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.ontology.OntModel

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.