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

Examples of com.hp.hpl.jena.assembler.assemblers.ContentAssembler.open()


        }
   
    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


        {
        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( "" ) ) );
        }
   
    public void testN3StringContentSingleTriples()
        {
View Full Code Here

    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( "" ) ) );
        }
   
    public void testSingleExternalContent()
        {
View Full Code Here

    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( "" ) ) );
        }   
   
    public void testMultipleExternalContent()
        {
View Full Code Here

        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( "" ) ) );
        }
   
    public void testIndirectContent()
View Full Code Here

        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( "" ) ) );   
        }
   
    public void testTrapsBadEncodings()
View Full Code Here

    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

        {
        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

        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( "" ) ) );
        }
   
    public void testSingleContentQuotation()
View Full Code Here

   
    public void testSingleContentQuotation()
        {
        Assembler a = new ContentAssembler();
        Resource root = resourceInModel( "c rdf:type ja:Content; c rdf:type ja:QuotedContent; c ja:quotedContent x; x P A; x Q B" );
        Content c = (Content) a.open( root );
        assertIsoModels( model( "x P A; x Q B" ), c.fill( model( "" ) ) );
        }
   
    public void testMultipleContentQuotation()
        {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.