org.topbraid.core.io
Class URLRegistry

java.lang.Object
  extended by org.topbraid.core.io.URLRegistry

public class URLRegistry
extends java.lang.Object

A singleton that maintains a mapping from URIs to the URLs where an ontology is physically stored. This registry is populated when a model is loaded from the web, and is mainly needed because some web ontologies contain a different base URI than they advertise. The prototypical example for this is SWRL, which is physically stored (and imported from) http://www.daml.org/rules/proposal/swrl.owl while its base URI is http://www.w3.org/2003/11/swrl In this case, an ontology would import the former URL.

Author:
Holger Knublauch

Constructor Summary
URLRegistry()
           
 
Method Summary
static URLRegistry get()
           
 java.net.URI getURI(java.net.URL url)
           
 java.net.URL getURL(java.net.URI uri)
           
 java.net.URI inspectAndRegister(java.net.URL url)
          Uses the XMLBaseExtractor to preview the base URI in the file at a given physical location.
 boolean isInspectedWithoutSuccess(java.net.URL url)
           
 void register(java.net.URL url, java.net.URI uri)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLRegistry

public URLRegistry()
Method Detail

get

public static URLRegistry get()

getURI

public java.net.URI getURI(java.net.URL url)

getURL

public java.net.URL getURL(java.net.URI uri)

inspectAndRegister

public java.net.URI inspectAndRegister(java.net.URL url)
Uses the XMLBaseExtractor to preview the base URI in the file at a given physical location. The method silently ignores any Exceptions.

Parameters:
url - the location of the file to inspect
Returns:
the URI that has been registered or null

isInspectedWithoutSuccess

public boolean isInspectedWithoutSuccess(java.net.URL url)

register

public void register(java.net.URL url,
                     java.net.URI uri)