in OWL2DTDL/DotNetRdfExtensions.cs [530:560]
public static string GetShortName(this Ontology ontology)
{
// Fallback way of getting a persistent short identifier in the
// (unlikely?) case that we are dealing w/ an anonymous ontology
if (!ontology.IsNamed())
{
return ontology.GetHashCode().ToString(invariantCulture);
}
// This is a simple string handling thing
string ontologyUriString = ontology.GetUri().AbsoluteUri;
// Trim any occurences of entity separation characters
if (ontologyUriString.EndsWith("/", StringComparison.Ordinal) || ontologyUriString.EndsWith("#", StringComparison.Ordinal))
{
char[] trimChars = { '/', '#' };
ontologyUriString = ontologyUriString.Trim(trimChars);
}
// Get the last bit of the string, after the last slash
ontologyUriString = ontologyUriString.Substring(ontologyUriString.LastIndexOf('/') + 1);
// If the string contains dots, treat them as file ending delimiter and get rid of them
// one at a time
while (ontologyUriString.Contains('.', StringComparison.Ordinal))
{
ontologyUriString = ontologyUriString.Substring(0, ontologyUriString.LastIndexOf('.'));
}
return ontologyUriString;
}