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

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

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

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

/** @see com.hp.hpl.jena.shared.PrefixMapping#getNsPrefixURI(java.lang.String) */
@Override
public String getNsPrefixURI(String prefix)
{
  String s = pmapLocal.getNsPrefixURI(prefix) ;
  if ( s != null )
    return s ;
  if ( pmapGlobal != null )
    return pmapGlobal.getNsPrefixURI(prefix) ;
  return null ;
}
origin: com.hp.hpl.jena/arq

/** Lookup a prefix for this query, including the default prefixes */
public String getPrefix(String prefix)
{
  return prefixMap.getNsPrefixURI(prefix) ;
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

/** Lookup a prefix for this query, including the default prefixes */
public String getPrefix(String prefix)
{
  return prefixMap.getNsPrefixURI(prefix) ;
}
origin: com.hp.hpl.jena/arq

/** @see com.hp.hpl.jena.shared.PrefixMapping#getNsPrefixURI(java.lang.String) */
public String getNsPrefixURI(String prefix)
{
  String s = pmapLocal.getNsPrefixURI(prefix) ;
  if ( s != null )
    return s ;
  if ( pmapGlobal != null )
    return pmapGlobal.getNsPrefixURI(prefix) ;
  return null ;
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

@Override
public String getNsPrefixURI(String prefix) {
  return this.prefixes.getNsPrefixURI(prefix);
}
origin: epimorphics/elda

/**
   Look for plausible candidates for prefixes in the SPARQL
   fragment and add them to <code>seen</code>.
*/
public void findPrefixesIn( String fragment ) {
  Matcher m = candidatePrefix.matcher( fragment );
  while (m.find()) {
    String candidate = m.group(1);
    if (pm.getNsPrefixURI( candidate ) != null) seen.add( candidate );
  }
}

origin: com.hp.hpl.jena/arq

/** @see com.hp.hpl.jena.shared.PrefixMapping#removeNsPrefix(java.lang.String) */
public PrefixMapping removeNsPrefix(String prefix)
{
  pmapLocal.removeNsPrefix(prefix) ;
  if ( pmapGlobal != null && pmapGlobal.getNsPrefixURI(prefix) != null )
    throw new UnsupportedOperationException("PrefixMapping2: prefix '"+prefix+"' in the immutable map") ;
  return this ;
}
origin: epimorphics/elda

public static String decodeMaybePrefixed(PrefixMapping pm, String shortName) {
  int cut = EldaNameUtils.prefixEndsAt( shortName );
  if (cut < 0) return null;
  String prefix = shortName.substring(0, cut - 1);
  String nameSpace = pm.getNsPrefixURI( prefix );
  if (nameSpace == null) return null;
  return nameSpace + shortName.substring(cut) ; 
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

/** @see com.hp.hpl.jena.shared.PrefixMapping#removeNsPrefix(java.lang.String) */
@Override
public PrefixMapping removeNsPrefix(String prefix)
{
  pmapLocal.removeNsPrefix(prefix) ;
  if ( pmapGlobal != null && pmapGlobal.getNsPrefixURI(prefix) != null )
    throw new UnsupportedOperationException("PrefixMapping2: prefix '"+prefix+"' in the immutable map") ;
  return this ;
}
origin: epimorphics/elda

private static String decodeMarkedPrefix( PrefixMapping pm, String prefix_encoded ) {
  int ubar = prefix_encoded.indexOf('_');
  if (ubar < 0) return null;
  String nameSpace = pm.getNsPrefixURI( prefix_encoded.substring(0, ubar) );
  if (nameSpace == null) return null;
  return nameSpace + decodeLightly( prefix_encoded.substring(ubar + 1) );
}

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

@Override
public String getNsPrefixURI( String prefix ) 
{ return getPrefixMapping().getNsPrefixURI( prefix ); }
origin: epimorphics/elda

/**
  Add SPARQL prefix declarations for all the prefixes in
  <code>pm</code> to the StringBuilder <code>q</code>.
*/
public static void appendPrefixes( StringBuilder q, PrefixMapping pm ) {
  for (String prefix: pm.getNsPrefixMap().keySet()) {
    q
      .append( "PREFIX " )
      .append( prefix )
      .append( ": <" )
      .append( pm.getNsPrefixURI(prefix) )
      .append( ">\n" );
  }
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

@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)
      {
      String ss = graphs.get(i).getPrefixMapping().getNsPrefixURI( prefix );
      if (ss != null) return ss;
      }
    }
  return s;
  }
  
origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

/** Set a prefix for this query */
public void setPrefix(String prefix, String expansion)
{
  try {
    // Removal may involve regeneration of the reverse mapping
    // so only do if needed.   
    String oldExpansion = prefixMap.getNsPrefixURI(prefix) ;
    if ( Lib.equal(oldExpansion, expansion) )
      return ;
    if ( oldExpansion != null )
      prefixMap.removeNsPrefix(prefix) ;
    
    prefixMap.setNsPrefix(prefix, expansion) ;
  } catch (PrefixMapping.IllegalPrefixException ex)
  {
    Log.warn(this, "Illegal prefix mapping(ignored): "+prefix+"=>"+expansion) ;
  }
}   
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")) ;
}
 
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/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 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

@SuppressWarnings("deprecation")
@Test public void persistent1()
{
  String dir = ConfigTest.getTestingDir() ;
  FileOps.clearDirectory(dir) ;
  
  DatasetPrefixesTDB prefixes = DatasetPrefixesTDB.create(new Location(dir), new ConcurrencyPolicyMRSW()) ;
  PrefixMapping pmap1 = prefixes.getPrefixMapping() ;
  
  String x = pmap1.getNsPrefixURI("x") ;
  assertNull(x) ;
  prefixes.close();
}
 
origin: com.hp.hpl.jena/tdb

@SuppressWarnings("deprecation")
@Test public void persistent2()
{
  String dir = ConfigTest.getTestingDir() ;
  FileOps.clearDirectory(dir) ;
  
  DatasetPrefixesTDB prefixes = DatasetPrefixesTDB.create(new Location(dir), new ConcurrencyPolicyMRSW()) ;
  PrefixMapping pmap1 = prefixes.getPrefixMapping() ;
  
  pmap1.setNsPrefix("x", "http://foo/") ;
  prefixes.close() ;
  
  prefixes = DatasetPrefixesTDB.create(new Location(dir), new ConcurrencyPolicyMRSW()) ;
  assertEquals("http://foo/", pmap1.getNsPrefixURI("x")) ;
  prefixes.close();
}
 
com.hp.hpl.jena.sharedPrefixMappinggetNsPrefixURI

Javadoc

Get the URI bound to a specific prefix, null if there isn't one.

Popular methods of PrefixMapping

  • getNsPrefixMap
    Return a copy of the internal mapping from names to URI strings. Updating this copy will have no eff
  • setNsPrefix
    Specify the prefix name for a URI prefix string. Any existing use of that prefix name is overwritten
  • 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
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getSystemService (Context)
  • 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
  • Top plugins for Android Studio
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