Tabnine Logo
PrefixMapping2
Code IndexAdd Tabnine to your IDE (free)

How to use
PrefixMapping2
in
org.apache.jena.sparql.util

Best Java code snippets using org.apache.jena.sparql.util.PrefixMapping2 (Showing top 18 results out of 315)

origin: org.aksw.jena-sparql-api/jena-sparql-api-mapper

public SparqlEntityManagerFactory() {
  this.prologue = new Prologue(new PrefixMapping2(PrefixMapping.Extended));
  this.scanPackageNames = new LinkedHashSet<>();
}
origin: dice-group/NLIWOD

@Override
public String getNsPrefixURI(final String prefix) {
  String s = super.getLocalPrefixMapping().getNsPrefixURI(prefix);
  if (s != null) {
    return s;
  }
  PrefixMapping pmapGlobal = super.getGlobalPrefixMapping();
  s = pmapGlobal.getNsPrefixURI(prefix);
  if (s != null) {
    super.getLocalPrefixMapping().setNsPrefix(prefix, s);
    return s;
  }
  return null;
}
origin: dice-group/NLIWOD

@Override
public Map<String, String> getNsPrefixMap(final boolean includeGlobalMap) {
  return super.getNsPrefixMap(false);
}
origin: apache/jena

@Override
public PrefixMapping withDefaultMappings(PrefixMapping map)
{
  for ( Map.Entry<String, String> e : map.getNsPrefixMap().entrySet() )
  {
    String prefix = e.getKey();
    String uri = e.getValue();
    if ( getNsPrefixURI( prefix ) == null && getNsURIPrefix( uri ) == null )
    {
      setNsPrefix( prefix, uri );
    }
  }
  return this;
}
origin: SmartDataAnalytics/jena-sparql-api

public static void main(String[] args) {
  PrefixMapping2 pm = new PrefixMapping2(PrefixMapping.Extended);
  pm.setNsPrefix("o", "http://fp7-pp.publicdata.eu/ontology/");
  pm.setNsPrefix("foaf", FOAF.NS);
  Prologue prologue = new Prologue(pm);
origin: dice-group/NLIWOD

  @Override
  public String toString() {
    return "LocalMapping: " + super.getLocalPrefixMapping().toString();
  }
}
origin: apache/jena

/** Clear the local prefix map, but leave the immutable global one alone */
@Override
public PrefixMapping clearNsPrefixMap() {
  getLocalPrefixMapping().clearNsPrefixMap() ;
  return this ;
}
origin: SmartDataAnalytics/jena-sparql-api

public SparqlEntityManagerFactory() {
  this.prologue = new Prologue(new PrefixMapping2(PrefixMapping.Extended));
  this.scanPackageNames = new LinkedHashSet<>();
}
origin: dice-group/NLIWOD

@Override
public String getNsURIPrefix(final String uri) {
  String s = super.getLocalPrefixMapping().getNsURIPrefix(uri);
  if (s != null) {
    return s;
  }
  PrefixMapping pmapGlobal = super.getGlobalPrefixMapping();
  if (pmapGlobal == null) {
    return null;
  }
  if (pmapGlobal != null) {
    s = pmapGlobal.getNsURIPrefix(uri);
  }
  super.getLocalPrefixMapping().setNsPrefix(s, uri);
  return null;
}
origin: apache/jena

/** @see org.apache.jena.shared.PrefixMapping#getNsPrefixMap() */
@Override
public Map<String, String> getNsPrefixMap() { return getNsPrefixMap(true) ; }

origin: dice-group/NLIWOD

@Override
public PrefixMapping removeNsPrefix(final String prefix) {
  super.getLocalPrefixMapping().removeNsPrefix(prefix);
  return this;
}
origin: apache/jena

public void usePrologueFrom(Prologue other)
{
  prefixMap = new PrefixMapping2(other.prefixMap) ;
  seenBaseURI = false ;
  if ( other.resolver != null )
    resolver = IRIResolver.create(getBaseURI()) ;
}

origin: dice-group/NLIWOD

@Override
public String expandPrefix(final String prefixed) {
  String s = super.getLocalPrefixMapping().expandPrefix(prefixed);
  PrefixMapping pmapGlobal = super.getGlobalPrefixMapping();
  if (pmapGlobal == null) {
    return s;
  }
  if (s == null || s.equals(prefixed)) {
    if (pmapGlobal != null) {
      s = pmapGlobal.expandPrefix(prefixed);
    }
    if (s != null) {
      int colon = prefixed.indexOf(':');
      String prefix = prefixed.substring(0, colon);
      String uri = pmapGlobal.getNsPrefixURI(prefix);
      super.getLocalPrefixMapping().setNsPrefix(prefix, uri);
    }
  }
  return s;
}
origin: apache/jena

  @Override
  public boolean samePrefixMappingAs(PrefixMapping other)
  {
    if ( other == null )
      return false ;
    
    if ( other instanceof PrefixMapping2 )
    {
      PrefixMapping2 other2 = (PrefixMapping2)other ;
      
      return this.pmapGlobal.samePrefixMappingAs(other2.pmapGlobal) && 
          this.pmapLocal.samePrefixMappingAs(other2.pmapLocal) ;
    }
    
    // Do by map copy.
    return getNsPrefixMap().equals( other.getNsPrefixMap() );
  }
}
origin: apache/jena

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 )
    r = IRIResolver.create(base) ;
  return new Prologue(ext, r) ;
}

origin: dice-group/NLIWOD

/** @see org.apache.jena.shared.PrefixMapping#shortForm(java.lang.String) */
@Override
public String shortForm(final String uri) {
  PrefixMapping pmapLocal = super.getLocalPrefixMapping();
  PrefixMapping pmapGlobal = super.getGlobalPrefixMapping();
  String s = pmapLocal.shortForm(uri);
  if (pmapGlobal == null) {
    return s;
  }
  if (s == null || s.equals(uri)) {
    s = pmapGlobal.shortForm(uri);
    if (s != null && !s.equals(uri)) {
      boolean b = false;
      try {
        b = (boolean) checkValidPrefixMethod.invoke(null, s);
      } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      if (b) {
        String prefix = s.substring(0, s.indexOf(":"));
        pmapLocal.setNsPrefix(prefix, pmapGlobal.getNsPrefixURI(prefix));
      }
    }
  }
  return s;
}
origin: apache/jena

pmap = pm2.getNsPrefixMap(false) ;
origin: dice-group/NLIWOD

/** @see org.apache.jena.shared.PrefixMapping#qnameFor(java.lang.String) */
@Override
public String qnameFor(final String uri) {
  PrefixMapping pmapLocal = super.getLocalPrefixMapping();
  PrefixMapping pmapGlobal = super.getGlobalPrefixMapping();
  String s = pmapLocal.qnameFor(uri);
  if (s != null) {
    return s;
  }
  if (pmapGlobal != null) {
    s = pmapGlobal.qnameFor(uri);
    if (s != null) {
      boolean b = false;
      try {
        b = (boolean) checkValidPrefixMethod.invoke(null, s);
      } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      if (b) {
        String prefix = s.substring(0, s.indexOf(":"));
        pmapLocal.setNsPrefix(prefix, pmapGlobal.getNsPrefixURI(prefix));
      }
    }
  }
  return s;
}
org.apache.jena.sparql.utilPrefixMapping2

Javadoc

A prefix mapping based on global and local mappings. Updates go to the local (second) copy only. Lookup looks in the local copy before the global copy.

Most used methods

  • <init>
  • getLocalPrefixMapping
  • getNsPrefixMap
  • setNsPrefix
  • getGlobalPrefixMapping
  • getNsPrefixURI
  • getNsURIPrefix

Popular in Java

  • Running tasks concurrently on multiple threads
  • getApplicationContext (Context)
  • setContentView (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Option (scala)
  • Top Sublime Text plugins
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