internal static string ToMemberName(this OntologyResource ontologyResource) { var uri = ontologyResource.ToUri(); var namespaceMapper = ontologyResource.Graph.NamespaceMap; // TODO: Review neccessity of prefixes. At the moment it's only for skos:Concept, which seems redundant. var prefix = null as string; var name = null as string; if (namespaceMapper.ReduceToQName(uri.AbsoluteUri, out string qname)) { prefix = qname.Split(':')[0]; } if (string.IsNullOrWhiteSpace(uri.Fragment)) { name = uri.Segments.LastOrDefault(); } else { name = uri.Fragment.Substring(1); } if (string.IsNullOrWhiteSpace(prefix)) { prefix = string.Empty; } else { prefix = prefix.Uppercase(); } return(string.Concat(prefix, name)); }
internal ResourceAttributeDeclaration(OntologyResource ontologyResource) : base(new CodeTypeReference(typeof(T))) { this.Arguments.Add( new CodeAttributeArgument( new CodePrimitiveExpression( ontologyResource.ToUri().AbsoluteUri))); }