Package com.hp.hpl.jena.shared

Examples of com.hp.hpl.jena.shared.PrefixMapping


        }
       
    public void testCreateURIOtherMap()
        {
        String myNS = "eh:foo/bar#", suffix = "something";
        PrefixMapping mine = PrefixMapping.Factory.create().setNsPrefix( "mine", myNS );
        Node n = NodeCreateUtils.create( mine, "mine:" + suffix );
        assertEquals( myNS + suffix, n.getURI() );
        }
View Full Code Here


            }
        }
       
    public void testCreatePrefixed()
        {
        PrefixMapping pm = PrefixMapping.Factory.create();
        /* TODO Node n = */ NodeCreateUtils.create( pm, "xyz" );
        }
View Full Code Here

        /* TODO Node n = */ NodeCreateUtils.create( pm, "xyz" );
        }
       
    public void testToStringWithPrefixMapping()
        {
        PrefixMapping pm = PrefixMapping.Factory.create();
        String prefix = "spoo", ns = "abc:def/ghi#";
        pm.setNsPrefix( prefix, ns );
        String suffix = "bamboozle";
        assertEquals( prefix + ":" + suffix, NodeCreateUtils.create( ns + suffix ).toString( pm ) );   
        }
View Full Code Here

        assertEquals( new Triple( S, P, O ), t );
        }
       
    public void testTripleCreationMapped()
        {
        PrefixMapping pm = PrefixMapping.Factory.create()
            .setNsPrefix( "a", "ftp://foo/" )
            .setNsPrefix( "b", "http://spoo/" )
            ;
        Triple wanted = NodeCreateUtils.createTriple( "ftp://foo/x http://spoo/y c:z" );
        Triple got = NodeCreateUtils.createTriple( pm, "a:x b:y c:z" );
View Full Code Here

        assertTrue( t1.toString().indexOf( "\"object\"") > 0 );
        }
       
    public void testTripleToStringWithPrefixing()
        {
        PrefixMapping pm = PrefixMapping.Factory.create();
        pm.setNsPrefix( "spoo", "eg://domain.dom/spoo#" );
        Triple t1 = NodeCreateUtils.createTriple( "eg://domain.dom/spoo#a b c" );
        assertEquals( "spoo:a @eh:/b eh:/c", t1.toString( pm ) );
        }
View Full Code Here

        divider() ;
        IndentedWriter out = new IndentedWriter(System.out, lineNumbers) ;
       
        // Need to check if used.
        //PrefixMapping pmap = SSE.getDefaultPrefixMapWrite() ;
        PrefixMapping pmap = null ;
        SerializationContext sCxt = new SerializationContext(pmap) ;
        ItemWriter.write(out, item, sCxt) ;
        //item.output(out) ;
        out.ensureStartOfLine() ;
        out.flush();
View Full Code Here

    }

    @Override
    protected PrefixMapping createPrefixMapping()
    {
        PrefixMapping pmap = new PrefixMappingImpl() ;
        for ( Node gn : graphs )
        {
            if ( ! gn.isURI() ) continue ;
            Graph g = dataset.getGraph(gn) ;
            PrefixMapping pmapNamedGraph = g.getPrefixMapping() ;
            pmap.setNsPrefixes(pmapNamedGraph) ;
        }
        return pmap ;
    }
View Full Code Here

            Location location = getLocation() ;
            DatasetPrefixStorage prefixes = SetupTDB.makePrefixes(location, new DatasetControlNone()) ;
            for ( String gn : prefixes.graphNames() )
            {
                System.out.println("Graph: "+gn) ;
                PrefixMapping pmap = prefixes.getPrefixMapping(gn) ;
                Map<String, String> x = pmap.getNsPrefixMap() ;
                for ( String k : x.keySet() )
                    System.out.printf("  %-10s %s\n", k+":", x.get(k)) ;
            }
        }
View Full Code Here

    private static void includePrefixesFor( Assembler a, Resource root, PrefixMapping result, Property includeUsing )
        {
        for (StmtIterator it = root.listProperties( includeUsing ); it.hasNext();)
            {
            Statement s = it.nextStatement();
            PrefixMapping sub = (PrefixMapping) a.open( getResource( s ) );
            result.setNsPrefixes( sub );
            }
        }
View Full Code Here

        return this;
        }
        
    @Override public String getNsPrefixURI( String prefix )
        {
        PrefixMapping bm = getBaseMapping();
        String s = bm.getNsPrefixURI( prefix );
        if (s == null && prefix.length() > 0)
            {
            List<Graph> graphs = poly.getSubGraphs();
            for (int i = 0; i < graphs.size(); i += 1)
                {
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.shared.PrefixMapping

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.