Package com.hp.hpl.jena.ontology

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


        assertEquals( justList, ins.getIdiomaticListTypes() );
        }

    @Test public void testFindsNoBrokenLists()
        {
        OntModel om = ontModel( "" );
        ins.inspectModel( r, om );
        assertEquals( resourceSet( "" ), ins.getSuspectListTypes() );
        }
View Full Code Here


        {
        StmtIterator it = xListT.getBaseModel().listStatements();
        while (it.hasNext())
            {
            Statement s = it.nextStatement();
            OntModel m = ModelFactory.createOntologyModel();
            m.add( xListT.getBaseModel() );
            m.remove( s );
            ListInspector x = new ListInspector();
            x.inspectModel( new Report(), m );
            if (!s.equalsstatement( "x rdfs:subClassOf rdf:List" ) ))
                assertEquals( "BROKEN for missing " + s, 1, x.getSuspectListTypes().size() );
            if (x.getIdiomaticListTypes().size() > 1)
                fail( "list type mistakenly found from partial description " + nice( m.getBaseModel().getGraph(), new HashMap<Node, Object>() ) );
            }
        }
View Full Code Here

        {
        String partialDesc =
            "B rdfs:subClassOf rdf:List"
            + "; B rdfs:subClassOf [owl:onProperty rdf:first & owl:allValuesFrom T]"
            + "; B rdfs:subClassOf [owl:onProperty rdf:first & owl:allValuesFrom B]";
        OntModel om = ontModel( partialDesc );
        ins.inspectModel( r, om );
        String expected = "[eye:mainProperty eye:suspectListIdiom & eye:suspectListIdiom B]";
        assertIsoModels( itemModel( expected ), r.model() );
        }
View Full Code Here

        assertTrue( ins.getIdiomaticListTypes().containsKey( resource( "x" ) ) );
        }
   
    @Test public void testTwoListTypesDetected()
        {
        OntModel m = ModelFactory.createOntologyModel();
        m.getBaseModel().add( xListT.getBaseModel() );
        m.getBaseModel().add( yListU.getBaseModel() );
        ins.inspectModel( r, m );
        assertEquals( 3, ins.getIdiomaticListTypes().size() );
        assertTrue( ins.getIdiomaticListTypes().containsKey( resource( "x" ) ) );
        assertTrue( ins.getIdiomaticListTypes().containsKey( resource( "y" ) ) );
        }
View Full Code Here

        assertEquals( resource( "U" ), ins.getIdiomaticListTypes().get( resource( "y" ) ) );
        }
   
    @Test public void testFindsNoPropertiesWithListRange()
        {
        OntModel om = ontModel( "" );
        ins.inspectModel( r, om );
        assertEquals( Collections.EMPTY_MAP, ins.getIdiomaticListProperties() );
        }
View Full Code Here

        assertEquals( Collections.EMPTY_MAP, ins.getIdiomaticListProperties() );
        }
   
    @Test public void testFindsPropertiesWithListRange()
        {
        OntModel om = (OntModel) ontModel( "P rdfs:range x; Q rdfs:range z" ).add( xListT );
        ins.inspectModel( r, om );
        assertEquals( resourceSet( "P" ), ins.getIdiomaticListProperties().keySet() );
        }
View Full Code Here

        assertEquals( resourceSet( "b" ), history );
        }
   
    @Test public void testChecksNilWellFormed()
        {
        OntModel om = ontModel( "a P rdf:nil" );
        ins.inspectList( r, statement( "a P rdf:nil"), resource( om, "rdf:nil" ) );
        assertIsoModels( model(), r.model() );
        }
View Full Code Here

        assertIsoModels( model(), r.model() );
        }
   
    @Test public void testChecksSingletonListWellFormed()
        {
        OntModel om = ontModel( "a P b; b rdf:first F; b rdf:rest rdf:nil" );
        ins.inspectList( r, statement( "a P b"), resource( om, "b" ) );
        assertIsoModels( model(), r.model() );
        }
View Full Code Here

        assertIsoModels( model(), r.model() );
        }
   
    @Test public void testReportsFirstlessList()
        {
        OntModel om = ontModel( "a P b; b rdf:rest rdf:nil" );
        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:hasNoFirst 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 testReportsMultipleFirstList()
        {
        OntModel om = ontModel( "a P b; b rdf:first X & rdf:first Y & rdf:rest rdf:nil" );
        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:hasMultipleFirsts b]] rdf:type eye:Item";
        assertIsoModels( itemModel( expected, statement( "a P b" ) ), 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.