edu.stanford.smi.protegex.owl.jena
Class DefaultURIResolver

java.lang.Object
  extended byedu.stanford.smi.protegex.owl.jena.DefaultURIResolver
All Implemented Interfaces:
URIResolver

public class DefaultURIResolver
extends Object
implements URIResolver

The default implementation of URIResolver, using the project's OntPolicy file.

Author:
Holger Knublauch

Field Summary
private  edu.stanford.smi.protege.model.Project project
           
 
Constructor Summary
DefaultURIResolver(edu.stanford.smi.protege.model.Project project)
           
 
Method Summary
private  String getApplicationDirectory()
           
protected  URL getLocalProtegeURL()
           
protected  URL getLocalSWRLBURL()
           
protected  URL getLocalSWRLURL()
           
 URL getPhysicalURL(URI uri)
          Converts a logical URI into a physical URL.
 String getPreferredNamespacePrefix(String namespace)
          Gets the prefix that should be used for a namespace if no other prefix has been defined yet.
 String getRelativePhysicalFileName(URI uri)
          If the result of getPhysicalURL() is internally derived from a relative file, then this returns the relative file name.
 boolean isEditableImport(URI uri)
          Checks if a given import is editable for the current OWLModel.
protected  boolean isIgnoredImport(String uri)
           
private  void save()
           
 void setEditableImport(URI uri, boolean value)
           
 void setPhysicalURL(URI uri, String relativeFileName)
          Sets the physical URL of an URI to point to a relative file.
 void setPhysicalURL(URI uri, URL physicalURL)
          Sets the physical URL of an URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

project

private edu.stanford.smi.protege.model.Project project
Constructor Detail

DefaultURIResolver

public DefaultURIResolver(edu.stanford.smi.protege.model.Project project)
Method Detail

getApplicationDirectory

private String getApplicationDirectory()

getPhysicalURL

public URL getPhysicalURL(URI uri)
Description copied from interface: URIResolver
Converts a logical URI into a physical URL.

Specified by:
getPhysicalURL in interface URIResolver
Parameters:
uri - the logical URI
Returns:
the physical URL (often the same as url)

getRelativePhysicalFileName

public String getRelativePhysicalFileName(URI uri)
Description copied from interface: URIResolver
If the result of getPhysicalURL() is internally derived from a relative file, then this returns the relative file name.

Specified by:
getRelativePhysicalFileName in interface URIResolver
Parameters:
uri - the logical URI
Returns:
the relative file name or null if the URL is absolute

getPreferredNamespacePrefix

public String getPreferredNamespacePrefix(String namespace)
Description copied from interface: URIResolver
Gets the prefix that should be used for a namespace if no other prefix has been defined yet. If no such entry is found during loading, the system will generate one automatically (e.g., "p1").

Specified by:
getPreferredNamespacePrefix in interface URIResolver
Parameters:
namespace - the namespace to get a prefix for (including '#')
Returns:
a valid, non-empty namespace prefix or null for default

isEditableImport

public boolean isEditableImport(URI uri)
Description copied from interface: URIResolver
Checks if a given import is editable for the current OWLModel. This is used to determine whether a given TripleStore shall be editable or not. Not editable TripleStores will not be saved to disc. If the method returns true, then there must be a physical file URL for the URI.

Specified by:
isEditableImport in interface URIResolver
Parameters:
uri - the URI of the import (usually the name of the associated TripleStore)
Returns:
true if uri points to an editable file

getLocalProtegeURL

protected URL getLocalProtegeURL()
                          throws MalformedURLException
Throws:
MalformedURLException

getLocalSWRLURL

protected URL getLocalSWRLURL()
                       throws MalformedURLException
Throws:
MalformedURLException

getLocalSWRLBURL

protected URL getLocalSWRLBURL()
                        throws MalformedURLException
Throws:
MalformedURLException

isIgnoredImport

protected boolean isIgnoredImport(String uri)

setEditableImport

public void setEditableImport(URI uri,
                              boolean value)
Specified by:
setEditableImport in interface URIResolver

setPhysicalURL

public void setPhysicalURL(URI uri,
                           URL physicalURL)
Description copied from interface: URIResolver
Sets the physical URL of an URI.

Specified by:
setPhysicalURL in interface URIResolver
Parameters:
uri - the URI to set the URL of
physicalURL - the new physcial URL or null to reset this URI

setPhysicalURL

public void setPhysicalURL(URI uri,
                           String relativeFileName)
Description copied from interface: URIResolver
Sets the physical URL of an URI to point to a relative file.

Specified by:
setPhysicalURL in interface URIResolver
Parameters:
uri - the URI to set the URL of
relativeFileName - the name of the file (not null)

save

private void save()