Protégé-OWL 3.3.1

edu.stanford.smi.protegex.owl.jena.parser
Class DefaultURI2NameConverter

java.lang.Object
  extended by edu.stanford.smi.protegex.owl.jena.parser.DefaultURI2NameConverter
All Implemented Interfaces:
URI2NameConverter

public class DefaultURI2NameConverter
extends Object
implements URI2NameConverter

Author:
Holger Knublauch

Constructor Summary
DefaultURI2NameConverter(OWLModel owlModel, ProtegeOWLParserLogger logger, boolean incremental)
           
 
Method Summary
 String addPrefix(String uri, String prefix)
          Adds a new prefix-namespace pair to this converter.
 String createAnonymousRDFResourceName()
           
 String createNewPrefix(String uri)
          Creates a dummy prefix and adds it to the OWLModel
 String getRDFExternalResourceName()
           
 String getRDFResourceName(String uri)
          Gets the Protege resource name for a given URI.
 String getResourceNamespace(String uri)
          Gets the namespace part of a resource URI.
 String getTemporaryRDFResourceName(com.hp.hpl.jena.rdf.arp.AResource node)
           
 String getTemporaryRDFResourceName(String uri)
           
 String getURIFromTemporaryName(String temporaryName)
          The inverse of getTemporaryRDFResourceName().
 boolean isAnonymousRDFResourceName(String name)
          Checks whether a given name describes an anonymous resource.
protected  boolean isPreferredPrefix(String prefix, String uri)
           
 boolean isTemporaryRDFResourceName(String name)
          Checks if this is a name that was created as a temporary name before.
 void updateInternalState()
          Called after the triples have been copied and new namespace prefixes assigned.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultURI2NameConverter

public DefaultURI2NameConverter(OWLModel owlModel,
                                ProtegeOWLParserLogger logger,
                                boolean incremental)
Method Detail

addPrefix

public String addPrefix(String uri,
                        String prefix)
Description copied from interface: URI2NameConverter
Adds a new prefix-namespace pair to this converter. If the namespace is already used under a different prefix then the already existing one will be used and returned. If the prefix is already used for a different namespace, then the prefix will not be used.

Specified by:
addPrefix in interface URI2NameConverter
Parameters:
uri - the URI/namespace
prefix - the new prefix
Returns:
the prefix that will be used for the namespace

createAnonymousRDFResourceName

public String createAnonymousRDFResourceName()
Specified by:
createAnonymousRDFResourceName in interface URI2NameConverter

createNewPrefix

public String createNewPrefix(String uri)
Description copied from interface: URI2NameConverter
Creates a dummy prefix and adds it to the OWLModel

Specified by:
createNewPrefix in interface URI2NameConverter
Parameters:
uri - the URI of the resource to create a new prefix for

getRDFExternalResourceName

public String getRDFExternalResourceName()
Specified by:
getRDFExternalResourceName in interface URI2NameConverter

getRDFResourceName

public String getRDFResourceName(String uri)
Description copied from interface: URI2NameConverter
Gets the Protege resource name for a given URI.

Specified by:
getRDFResourceName in interface URI2NameConverter
Parameters:
uri - the URI to get the name of
Returns:
the Protege name (not null)

getResourceNamespace

public String getResourceNamespace(String uri)
Description copied from interface: URI2NameConverter
Gets the namespace part of a resource URI. This typically wraps the Jena namespace split algorithm.

Specified by:
getResourceNamespace in interface URI2NameConverter
Parameters:
uri - the URI to get the namespace of
Returns:
the namespace (usually including the '#')

getTemporaryRDFResourceName

public String getTemporaryRDFResourceName(String uri)
Specified by:
getTemporaryRDFResourceName in interface URI2NameConverter

getTemporaryRDFResourceName

public String getTemporaryRDFResourceName(com.hp.hpl.jena.rdf.arp.AResource node)
Specified by:
getTemporaryRDFResourceName in interface URI2NameConverter

getURIFromTemporaryName

public String getURIFromTemporaryName(String temporaryName)
Description copied from interface: URI2NameConverter
The inverse of getTemporaryRDFResourceName().

Specified by:
getURIFromTemporaryName in interface URI2NameConverter
Parameters:
temporaryName - the temporary name
Returns:
the URI encoded by the temp name

isAnonymousRDFResourceName

public boolean isAnonymousRDFResourceName(String name)
Description copied from interface: URI2NameConverter
Checks whether a given name describes an anonymous resource.

Specified by:
isAnonymousRDFResourceName in interface URI2NameConverter
Parameters:
name - the name of the resource to test
Returns:
true if name is an anonymous name

isPreferredPrefix

protected boolean isPreferredPrefix(String prefix,
                                    String uri)

isTemporaryRDFResourceName

public boolean isTemporaryRDFResourceName(String name)
Description copied from interface: URI2NameConverter
Checks if this is a name that was created as a temporary name before. Temporary names should follow a naming convention which keeps them clearly separate from real names.

Specified by:
isTemporaryRDFResourceName in interface URI2NameConverter
Parameters:
name - the name to test
Returns:
true if name is a temporary test

updateInternalState

public void updateInternalState()
Description copied from interface: URI2NameConverter
Called after the triples have been copied and new namespace prefixes assigned. This method must update the internal state of the converter to reflect possible changes during loading (e.g. add new prefixes).

Specified by:
updateInternalState in interface URI2NameConverter

Protégé-OWL 3.3.1

Submit a bug report or feature request
Copyright (c) 1998-2007 Stanford University.