Package com.hp.hpl.jena.shared

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


  }

  @Test
  public void testWithDefaultMappings()
  {
    PrefixMapping pm = new PrefixMappingImpl();
    pm.setNsPrefix( "example", "http://example.com");
    try
    {
      // make sure that it must update
      securedMapping.withDefaultMappings(pm);
      if (!securityEvaluator.evaluate(Action.Update,
View Full Code Here


  }
 
  @Test
  public void testWithDefaultMappingsNoAdd()
  {
    PrefixMapping pm = new PrefixMappingImpl();
    try
    {
      // make sure that it must update
      securedMapping.withDefaultMappings(pm);
//      if (!securityEvaluator.evaluate(Action.Update,
View Full Code Here

        this.resolver = other.resolver ;
    }

    public Prologue copy()
    {
        PrefixMapping prefixMap = new PrefixMappingImpl() ;
        prefixMap.setNsPrefixes(this.prefixMap) ;
        String baseURI = null ;
        if ( resolver != null)
            baseURI = resolver.getBaseIRIasString() ;
       
        return new Prologue(prefixMap, baseURI) ;
View Full Code Here

    public Prologue sub(String base) { return sub(null, base) ; }
   
    public Prologue sub(PrefixMapping newMappings, String base)
    {
        // New prefix mappings
        PrefixMapping ext = getPrefixMapping() ;
        if ( newMappings != null )
            ext = new PrefixMapping2(ext, newMappings) ;
        // New base.
        IRIResolver r = resolver ;
        if ( base != null )
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

    }

    @Test public void multiple1()
    {
        DatasetPrefixesTDB prefixes = DatasetPrefixesTDB.testing() ;
        PrefixMapping pmap1 = prefixes.getPrefixMapping() ;
        PrefixMapping pmap2 = prefixes.getPrefixMapping("http://graph/") ;
        pmap1.setNsPrefix("x", "http://foo/") ;
        assertNull(pmap2.getNsPrefixURI("x")) ;
        assertNotNull(pmap1.getNsPrefixURI("x")) ;
    }
View Full Code Here

    }
   
    @Test public void multiple2()
    {
        DatasetPrefixesTDB prefixes = DatasetPrefixesTDB.testing() ;
        PrefixMapping pmap1 = prefixes.getPrefixMapping("http://graph/") // Same
        PrefixMapping pmap2 = prefixes.getPrefixMapping("http://graph/") ;
        pmap1.setNsPrefix("x", "http://foo/") ;
        assertNotNull(pmap2.getNsPrefixURI("x")) ;
        assertNotNull(pmap1.getNsPrefixURI("x")) ;
    }
View Full Code Here

    {
        String dir = ConfigTest.getTestingDir() ;
        FileOps.clearDirectory(dir) ;
       
        DatasetPrefixesTDB prefixes = DatasetPrefixesTDB.create(new Location(dir), new DatasetControlMRSW()) ;
        PrefixMapping pmap1 = prefixes.getPrefixMapping() ;
       
        String x = pmap1.getNsPrefixURI("x") ;
        assertNull(x) ;
        prefixes.close();
    }
View Full Code Here

    {
        String dir = ConfigTest.getTestingDir() ;
        FileOps.clearDirectory(dir) ;
       
        DatasetPrefixesTDB prefixes = DatasetPrefixesTDB.create(new Location(dir), new DatasetControlMRSW()) ;
        PrefixMapping pmap1 = prefixes.getPrefixMapping() ;
       
        pmap1.setNsPrefix("x", "http://foo/") ;
        prefixes.close() ;
       
        prefixes = DatasetPrefixesTDB.create(new Location(dir), new DatasetControlMRSW()) ;
        assertEquals("http://foo/", pmap1.getNsPrefixURI("x")) ;
        prefixes.close();
    }
View Full Code Here

        }
        String DB = ConfigTest.getCleanDir() ;
        {
            // 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();
        }
        FileOps.deleteSilent(DB);
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.