Package com.hp.hpl.jena.assembler.assemblers

Examples of com.hp.hpl.jena.assembler.assemblers.ContentAssembler


    @Override protected Class<? extends Assembler> getAssemblerClass()
        { return ContentAssembler.class; }

    public void testContentAssemblerType()
        { testDemandsMinimalType( new ContentAssembler(), JA.Content )}
View Full Code Here


        // assertSubclassOf( JA.LiteralContent, JA.Content );
        }
   
    public void testContent()
        {
        Assembler a = new ContentAssembler();
        Content c = (Content) a.open( resourceInModel( "x rdf:type ja:Content" ) );
        assertNotNull( c );
        Model m = ModelFactory.createDefaultModel();
        c.fill( m );
        assertEquals( 0, m.size() );
        }
View Full Code Here

        assertEquals( 0, m.size() );
        }
   
    public void testMultipleLiteralsWorks()
        {
        Assembler a = new ContentAssembler();
        String A = "<eh:/A> a <eh:/Type>.".replaceAll( " ", "\\\\s" );
        String B = "<eh:/Type> a rdfs:Class.".replaceAll( " ", "\\\\s" );
        Resource root = resourceInModel( "x rdf:type ja:Content; x rdf:type ja:LiteralContent; x ja:literalContent '" + A + "'; x ja:literalContent '" + B + "'" );
        Content C = (Content) a.open( root );
        assertIsoModels( model( "Type rdf:type rdfs:Class; A rdf:type Type" ), C.fill( model( "" ) ) );
        }
View Full Code Here

        testStringContent( "x rdf:value 5; y owl:sameAs x", "<eh:/x> rdf:value 5 . <eh:/y> owl:sameAs <eh:/x> ." );
        }
   
    public void testRDFXMLContent()
        {
        Assembler a = new ContentAssembler();
        String Stuff = "<owl:Class></owl:Class>".replaceAll( " ", "\\\\s" );
        Resource root = resourceInModel( "x rdf:type ja:Content; x rdf:type ja:LiteralContent; x ja:literalContent '" + Stuff + "'; x ja:contentEncoding 'RDF/XML'" );
        Content c = (Content) a.open( root );
        assertIsoModels( model( "_x rdf:type owl:Class" ), c.fill( model( "" ) ) );
        }
View Full Code Here

        assertIsoModels( model( "_x rdf:type owl:Class" ), c.fill( model( "" ) ) );
        }
   
    public void testSingleExternalContent()
        {
        Assembler a = new ContentAssembler();
        String source = Testing + "/schema.n3";
        Resource root = resourceInModel( "x rdf:type ja:Content; x rdf:type ja:ExternalContent; x ja:externalContent file:" + source );
        Content c = (Content) a.open( root );
        assertIsoModels( FileManager.get().loadModel( "file:" + source ), c.fill( model( "" ) ) );
        }   
View Full Code Here

        assertIsoModels( FileManager.get().loadModel( "file:" + source ), c.fill( model( "" ) ) );
        }   
   
    public void testMultipleExternalContent()
        {
        Assembler a = new ContentAssembler();
        String sourceA = Testing + "/schema.n3";
        String sourceB = Testing + "/schema2.n3";
        Resource root = resourceInModel
            ( "x rdf:type ja:Content; x rdf:type ja:ExternalContent"
            + "; x ja:externalContent file:" + sourceA + "; x ja:externalContent file:" + sourceB );
        Content c = (Content) a.open( root );
        Model wanted = FileManager.get().loadModel( "file:" + sourceA ).add( FileManager.get().loadModel( "file:" + sourceB ) );
        assertIsoModels( wanted, c.fill( model( "" ) ) );
        }
View Full Code Here

        assertIsoModels( wanted, c.fill( model( "" ) ) );
        }
   
    public void testIndirectContent()
        {
        Assembler a = new ContentAssembler();
        Resource root = resourceInModel
            ( "x rdf:type ja:Content; x ja:content y"
            + "; y rdf:type ja:Content; y ja:content z"
            + "; z rdf:type ja:Content; z ja:quotedContent A; A P B"  );
        Content c = (Content) a.open( root );
        Model wanted = model( "A P B" );
        assertIsoModels( wanted, c.fill( model( "" ) ) );   
        }
View Full Code Here

        assertIsoModels( wanted, c.fill( model( "" ) ) );   
        }
   
    public void testTrapsBadEncodings()
        {
        Assembler a = new ContentAssembler();
        Resource root = resourceInModel( "x rdf:type ja:Content; x ja:contentEncoding 'bogus'; x ja:literalContent 'sham'" );
        try
            { a.open( root ); fail( "should trap bad encoding" ); }
        catch (UnknownEncodingException e)
            {
            assertEquals( "bogus", e.getEncoding() );
            assertEquals( resource( "x" ), e.getRoot() );
            }
View Full Code Here

        testContentTrapsBadObjects( "ja:literalContent", "'plume'fr" );
        }

    private void testContentTrapsBadObjects( String property, String value )
        {
        Assembler a = new ContentAssembler();
        Resource root = resourceInModel
            ( "x rdf:type ja:Content; x <property> <value>"
            .replaceAll( "<property>", property ).replaceAll( "<value>", value ) );
        try { a.open( root ); fail( "should trap bad content resource" ); }
        catch (BadObjectException e)
            {
            assertEquals( resource( "x" ), e.getRoot() );
            assertEquals( rdfNode( empty, value ), e.getObject() );
            }
View Full Code Here

            }
        }
   
    public void testMixedContent()
        {
        Assembler a = new ContentAssembler();
        String source = Testing + "/schema.n3";
        Resource root = resourceInModel
            ( "x rdf:type ja:Content; x rdf:type ja:LiteralContent; x rdf:type ja:ExternalContent"
            + "; x ja:literalContent '<eh:/eggs>\\srdf:type\\srdf:Property.'"
            + "; x ja:externalContent file:" + source );
        Content c = (Content) a.open( root );
        Model wanted = FileManager.get().loadModel( "file:" + source ).add( model( "eggs rdf:type rdf:Property" ) );
        assertIsoModels( wanted, c.fill( model( "" ) ) );
        }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.assembler.assemblers.ContentAssembler

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.