Package com.hp.hpl.jena.shared

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


        String DB = ConfigTest.getTestingDirDB() ;
        FileOps.clearDirectory(DB) ;
        {
            // Create new DB (assuming it's empty now)
            Graph graph = TDBFactory.createDatasetGraph(DB).getDefaultGraph() ;
            PrefixMapping pm = graph.getPrefixMapping();
            pm.setNsPrefix("test", "http://test");
            graph.close();
        }

        {
            // Reconnect to the same DB
            Graph graph = TDBFactory.createDatasetGraph(DB).getDefaultGraph() ;
            PrefixMapping pm = graph.getPrefixMapping();
            Map<String, String> map = pm.getNsPrefixMap();
            assertEquals(1, map.size()) ;
            //System.out.println("Size: " + map.size());
            String ns = pm.getNsPrefixURI("test");
            //System.out.println("Namespace: " + ns);
            assertEquals("http://test", ns) ;
            graph.close();
        }
        ConfigTest.deleteTestingDirDB() ;
View Full Code Here


    /** Return a PrefixMapping for a named graph */
    @Override
    public PrefixMapping getPrefixMapping(String graphName)
    {
        PrefixMapping pm = new GraphPrefixesProjection(graphName, this) ;
        // Force into cache.
        // See JENA-81
        pm.getNsPrefixMap() ;
        return pm ;
    }
View Full Code Here

    }

    @Override
    public PrefixMapping getPrefixMapping()
    {
        PrefixMapping x = other.getPrefixMapping() ;
        info("getPrefixMapping() -> "+x) ;
        return x ;
    }
View Full Code Here

    }

    @Override
    public PrefixMapping getPrefixMapping(String graphName)
    {
        PrefixMapping x = other.getPrefixMapping(graphName) ;
        info("getPrefixMapping("+graphName+") -> "+x) ;
        return x ;
    }
View Full Code Here

        for (; iter.hasNext();) {
            Triple t = iter.next() ;
            dsg.add(graphName, t.getSubject(), t.getPredicate(), t.getObject()) ;
        }

        PrefixMapping pmapSrc = data.getPrefixMapping() ;
        PrefixMapping pmapDest = dsg.getDefaultGraph().getPrefixMapping() ;
        pmapDest.withDefaultMappings(pmapSrc) ;
    }
View Full Code Here

    {
        try {
            if ( dataset != null )
            {
                // Load the models prefixes first
                PrefixMapping m = dataset.getDefaultModel() ;
                model.setNsPrefixes(m) ;
            }
            // Then add the queries (just the declared mappings)
            // so the query declarations override the data sources.
            model.setNsPrefixes(query.getPrefixMapping()) ;
View Full Code Here

         default implementation will display all the triples exposed by the graph (ie
         including reification triples if it is Standard).
    */
    public static String toString( String prefix, Graph that )
        {
        PrefixMapping pm = that.getPrefixMapping();
    StringBuilder b = new StringBuilder( prefix + " {" );
    int count = 0;
    String gap = "";
    ClosableIterator<Triple> it = GraphUtil.findAll( that );
    while (it.hasNext() && count < TOSTRING_TRIPLE_LIMIT)
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 ( Graph graph : graphs )
                {
View Full Code Here

  {
    // mapping only updates if there are map entries to add.  Since this gets called
    // when we are doing deep triple checks while writing we need to attempt the
    // update only if there are new updates to add.
   
    PrefixMapping m = holder.getBaseItem();
    PrefixMappingImpl pm = new PrefixMappingImpl();
    for ( Entry<String, String> e : map.getNsPrefixMap().entrySet())
    {
      if (m.getNsPrefixURI(e.getKey()) == null && m.getNsURIPrefix(e.getValue()) == null )
      {
        pm.setNsPrefix( e.getKey(), e.getValue() );
      }
    }
    if ( !pm.getNsPrefixMap().isEmpty())
View Full Code Here

public class SecuredPrefixMappingTest
{
  public static void runTests( final SecurityEvaluator securityEvaluator,
      final PrefixMapping prefixMapping ) throws Exception
  {
    final PrefixMapping pm = prefixMapping;
    Assert.assertNotNull("PrefixMapping may not be null", pm);
    Assert.assertTrue("PrefixMapping should be secured",
        pm instanceof SecuredPrefixMapping);
    final SecuredPrefixMappingTest pmTest = new SecuredPrefixMappingTest(
        securityEvaluator) {
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.