Tabnine Logo
PrefixMapping.setNsPrefix
Code IndexAdd Tabnine to your IDE (free)

How to use
setNsPrefix
method
in
com.hp.hpl.jena.shared.PrefixMapping

Best Java code snippets using com.hp.hpl.jena.shared.PrefixMapping.setNsPrefix (Showing top 20 results out of 315)

origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Register a new prefix/namespace mapping which will be used to shorten
 * the print strings for resources in known namespaces.
 */
public static void registerPrefix(String prefix, String namespace) {
  prefixMapping.setNsPrefix( prefix, namespace );
}

origin: com.hp.hpl.jena/arq

/** @see com.hp.hpl.jena.shared.PrefixMapping#setNsPrefix(java.lang.String, java.lang.String) */
public PrefixMapping setNsPrefix(String prefix, String uri)
{
  pmapLocal.setNsPrefix(prefix, uri) ;
  return this ;
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Register a new namespace prefix with the parser
 */
public void registerPrefix(String prefix, String namespace ) {
  prefixMapping.setNsPrefix(prefix, namespace);
}

origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

/** @see com.hp.hpl.jena.shared.PrefixMapping#setNsPrefix(java.lang.String, java.lang.String) */
@Override
public PrefixMapping setNsPrefix(String prefix, String uri)
{
  pmapLocal.setNsPrefix(prefix, uri) ;
  return this ;
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

  @Override public void prefix(String prefix, String uri)
  {
    try { // Jena applies XML rules to prerfixes.  
      prefixMapping.setNsPrefix(prefix, uri) ;
    } catch (JenaException ex) {}
  }
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

@Override
public void startPrefixMapping( String prefix, String uri )
  {
  if (PrefixMappingImpl.isNiceURI( uri )) prefixMapping.setNsPrefix( prefix, uri );
  }
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

@Override
public PrefixMapping setNsPrefix( String prefix, String uri )
{ 
  getPrefixMapping().setNsPrefix( prefix, uri ); 
  return this;
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

protected void setPrefix(int line, int col, String prefix, String uri)
{
  prefixMapping.setNsPrefix(prefix, uri) ;
  handler.prefix(line, col, prefix, uri) ;
}

origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

  @Override public void prefix(String prefix, String uri)
  {
    try { // Jena applies XML rules to prerfixes.
      graph.getPrefixMapping().setNsPrefix(prefix, uri) ;
    } catch (JenaException ex) {} 
  }
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

@Override public PrefixMapping setNsPrefix( String prefix, String uri ) 
  {
  checkUnlocked();
  getBaseMapping().setNsPrefix( prefix, uri );
  return this;
  }

origin: org.apache.clerezza.ext/org.apache.jena.jena-core

private static void setSimplePrefixes( Resource root, PrefixMapping result )
  {
  if (root.hasProperty( JA.prefix ))
    {
    Literal prefix = getUniqueLiteral( root, JA.prefix );
    Literal namespace = getUniqueLiteral( root, JA.namespace );
    result.setNsPrefix( prefix.getLexicalForm(), namespace.getLexicalForm() );
    }
  }
}
origin: com.hp.hpl.jena/sdb

  @Test public void prefix7()
  {
    String uri1 = "http://example/" ;
    String uri2 = "http://example/ns#" ;
    
    PrefixMapping pmap = new PrefixMappingSDB(defaultPrefixURI, sdb) ;
    pmap.setNsPrefix("ex1", uri1) ;
    pmap.setNsPrefix("ex2", uri2) ;
    assertEquals("ex2:foo", pmap.qnameFor("http://example/ns#foo")) ;
  }        
}
origin: com.hp.hpl.jena/sdb

@Test public void prefix4()
{
  String uri = "http://example/" ;
  PrefixMapping pmap = new PrefixMappingSDB(defaultPrefixURI, sdb) ;
  pmap.setNsPrefix("ex", uri) ;
  
  assertEquals("ex", pmap.getNsURIPrefix("http://example/")) ;
}
   
origin: com.hp.hpl.jena/sdb

@Test public void prefix2()
{
  PrefixMapping pmap = new PrefixMappingSDB(defaultPrefixURI, sdb) ;
  pmap.setNsPrefix("ex", "http://example/") ;
  assertNotNull(pmap.getNsPrefixURI("ex")) ;
}
 
origin: com.hp.hpl.jena/sdb

@Test public void prefix5()
{
  String uri = "http://example/" ;
  PrefixMapping pmap = new PrefixMappingSDB(defaultPrefixURI, sdb) ;
  pmap.setNsPrefix("ex", uri) ;
  
  assertEquals(uri+"foo", pmap.expandPrefix("ex:foo")) ;
}
origin: com.hp.hpl.jena/sdb

@Test public void prefix6()
{
  String uri = "http://example/" ;
  PrefixMapping pmap = new PrefixMappingSDB(defaultPrefixURI, sdb) ;
  pmap.setNsPrefix("ex", uri) ;
  
  assertEquals("ex:foo", pmap.qnameFor("http://example/foo")) ;
}
origin: com.hp.hpl.jena/sdb

@Test public void prefix3()
{
  String uri = "http://example/" ;
  PrefixMapping pmap = new PrefixMappingSDB(defaultPrefixURI, sdb) ;
  pmap.setNsPrefix("ex", uri) ;
  
  PrefixMapping pmap2 = new PrefixMappingSDB(defaultPrefixURI, sdb) ;
  String x = pmap2.getNsPrefixURI("ex") ;
  
  assertNotNull(x) ;
  assertEquals(uri,x) ;
}
   
origin: com.hp.hpl.jena/tdb

@BeforeClass static public void beforeClass()
{ 
  graph = TDBFactory.createGraph() ;
  Model m = ModelFactory.createModelForGraph(graph) ;
  FileManager.get().readModel(m, graphData) ;
  pmap = new PrefixMappingImpl() ;
  pmap.setNsPrefix("", "http://example/") ;
  
}
     
origin: com.hp.hpl.jena/tdb

@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")) ;
}
 
origin: com.hp.hpl.jena/tdb

@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")) ;
}
 
com.hp.hpl.jena.sharedPrefixMappingsetNsPrefix

Javadoc

Specify the prefix name for a URI prefix string. Any existing use of that prefix name is overwritten. The result is this same prefixMapping. (The earlier restriction that adding second prefix for the same URI caused the earlier binding to be deleted has been withdrawn.)

A prefix name must be a valid NCName, or the empty string. The empty string is reserved to mean "the default namespace".

Need not check the RFC2396 validity of the URI. Bad URIs are either silently ignored or behave as if they were good. The earlier restriction that the URI should end with a non-NCName character has been removed.

Note, in particular, that the a prefix mapping can only be used if it includes the URI up to any '#' character because '#' is not legal in the local part of an NCName.

Popular methods of PrefixMapping

  • getNsPrefixMap
    Return a copy of the internal mapping from names to URI strings. Updating this copy will have no eff
  • getNsPrefixURI
    Get the URI bound to a specific prefix, null if there isn't one.
  • setNsPrefixes
    Copies the prefix mapping from other into this. Illegal prefix mappings are detected. Existing binds
  • getNsURIPrefix
    Answer the prefix for the given URI, or null if there isn't one. If there is more than one, one of t
  • qnameFor
    Answer a qname with the expansion of the given uri, or null if no such qname can be constructed usin
  • expandPrefix
    Expand the uri using the prefix mappings if possible. If prefixed has the form Foo:Bar, and Foo is a
  • samePrefixMappingAs
    Answer true iff this prefix-mappings are equal, that is, map the same prefixes to the same URIs; sam
  • shortForm
    Compress the URI using the prefix mappings if possible. If there is a prefix mapping Name -> URIStar
  • lock
    Lock the PrefixMapping so that changes can no longer be made to it. Primarily intended to lock Stand
  • removeNsPrefix
    Remove any existing maplet with the given prefix name and answer this mapping. If the prefix is the
  • withDefaultMappings
    Update this PrefixMapping with the bindings in map, only adding those (p, u) pairs for which neither
  • withDefaultMappings

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (ScheduledExecutorService)
  • putExtra (Intent)
  • scheduleAtFixedRate (Timer)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • JFileChooser (javax.swing)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now