diff --git a/Trinity.OntologyGenerator/App.config b/Trinity.OntologyGenerator/App.config index 48fdbd7..a490d7d 100644 --- a/Trinity.OntologyGenerator/App.config +++ b/Trinity.OntologyGenerator/App.config @@ -54,7 +54,7 @@ - + @@ -76,6 +76,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Trinity.OntologyGenerator/OntologyGenerator.cs b/Trinity.OntologyGenerator/OntologyGenerator.cs index e53b5c2..0772f52 100644 --- a/Trinity.OntologyGenerator/OntologyGenerator.cs +++ b/Trinity.OntologyGenerator/OntologyGenerator.cs @@ -191,7 +191,7 @@ public void GenerateFile(FileInfo target) if(ontologies.Length > 0) { - string template = Properties.Resources.FileTemplate; + string template = Templates.FileTemplate; string content = string.Format(template, ontologies.ToString(), _namespace); if (string.IsNullOrEmpty(content)) @@ -212,7 +212,7 @@ private string GetOntologyTitle(IModel model) IEnumerable bindings = model.GetBindings(query, true); - return bindings.Any() ? bindings.First().ToString() : ""; + return bindings.Any() ? bindings.First().Values.First().ToString() : ""; } @@ -296,11 +296,11 @@ private string GenerateOntology(IModel model, string title, string description, { nsPrefix = nsPrefix.ToUpper(); - return string.Format(Properties.Resources.StringOntologyTemplate, nsPrefix, ns, result.ToString(), title, description); + return string.Format(Templates.StringOntologyTemplate, nsPrefix, ns, result.ToString(), title, description); } else { - return string.Format(Properties.Resources.OntologyTemplate, nsPrefix, ns, result.ToString(), title, description); + return string.Format(Templates.OntologyTemplate, nsPrefix, ns, result.ToString(), title, description); } } @@ -382,11 +382,11 @@ private string GenerateResource(IResource resource, Uri ontology, List l if (stringOnly) { - return string.Format(Properties.Resources.StringTemplate, type, name, resource.Uri.OriginalString, comment); + return string.Format(Templates.StringTemplate, type, name, resource.Uri.OriginalString, comment); } else { - return string.Format(Properties.Resources.ResourceTemplate, type, name, resource.Uri.OriginalString, comment); + return string.Format(Templates.ResourceTemplate, type, name, resource.Uri.OriginalString, comment); } } diff --git a/Trinity.OntologyGenerator/Properties/Resources.Designer.cs b/Trinity.OntologyGenerator/Properties/Resources.Designer.cs deleted file mode 100644 index 18d25b0..0000000 --- a/Trinity.OntologyGenerator/Properties/Resources.Designer.cs +++ /dev/null @@ -1,152 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Semiodesk.Trinity.OntologyGenerator.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Semiodesk.Trinity.OntologyGenerator.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to // Attention: This file is generated. Any modifications will eventually be overwritten. - /// - ///using System; - ///using System.Collections.Generic; - ///using System.Text; - ///using Semiodesk.Trinity; - /// - ///namespace {2} - ///{{ - /// {1} - ///}}. - /// - internal static string FileTemplate { - get { - return ResourceManager.GetString("FileTemplate", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to - //////<summary> - //////{3} - //////{4} - //////</summary> - ///public class {0} : Ontology - ///{{ - /// public static readonly Uri Namespace = new Uri("{1}"); - /// public static Uri GetNamespace() {{ return Namespace; }} - /// - /// public static readonly string Prefix = "{0}"; - /// public static string GetPrefix() {{ return Prefix; }} {2} - ///}} - ///. - /// - internal static string OntologyTemplate { - get { - return ResourceManager.GetString("OntologyTemplate", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to - /// - /// ///<summary> - /// ///{3} - /// ///</summary> - /// public static readonly {0} {1} = new {0}(new Uri("{2}"));. - /// - internal static string ResourceTemplate { - get { - return ResourceManager.GetString("ResourceTemplate", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to ///<summary> - //////{3} - //////{4} - //////</summary> - ///public static class {0} - ///{{ - /// public static readonly Uri Namespace = new Uri("{1}"); - /// public static Uri GetNamespace() {{ return Namespace; }} - /// - /// public static readonly string Prefix = "{0}"; - /// public static string GetPrefix() {{ return Prefix; }} {2} - ///}}. - /// - internal static string StringOntologyTemplate { - get { - return ResourceManager.GetString("StringOntologyTemplate", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to - /// - /// ///<summary> - /// ///{3} - /// ///</summary> - /// public const string {1} = "{2}";. - /// - internal static string StringTemplate { - get { - return ResourceManager.GetString("StringTemplate", resourceCulture); - } - } - } -} diff --git a/Trinity.OntologyGenerator/Properties/Resources.resx b/Trinity.OntologyGenerator/Properties/Resources.resx deleted file mode 100644 index 3535069..0000000 --- a/Trinity.OntologyGenerator/Properties/Resources.resx +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - // Attention: This file is generated. Any modifications will eventually be overwritten. - -using System; -using System.Collections.Generic; -using System.Text; -using Semiodesk.Trinity; - -namespace {2} -{{ - {1} -}} - - - -///<summary> -///{3} -///{4} -///</summary> -public class {0} : Ontology -{{ - public static readonly Uri Namespace = new Uri("{1}"); - public static Uri GetNamespace() {{ return Namespace; }} - - public static readonly string Prefix = "{0}"; - public static string GetPrefix() {{ return Prefix; }} {2} -}} - - - - - - ///<summary> - ///{3} - ///</summary> - public static readonly {0} {1} = new {0}(new Uri("{2}")); - - - ///<summary> -///{3} -///{4} -///</summary> -public static class {0} -{{ - public static readonly Uri Namespace = new Uri("{1}"); - public static Uri GetNamespace() {{ return Namespace; }} - - public static readonly string Prefix = "{0}"; - public static string GetPrefix() {{ return Prefix; }} {2} -}} - - - - - ///<summary> - ///{3} - ///</summary> - public const string {1} = "{2}"; - - \ No newline at end of file diff --git a/Trinity.OntologyGenerator/Templates.cs b/Trinity.OntologyGenerator/Templates.cs new file mode 100644 index 0000000..2afdc0b --- /dev/null +++ b/Trinity.OntologyGenerator/Templates.cs @@ -0,0 +1,65 @@ +namespace Semiodesk.Trinity.OntologyGenerator +{ + public class Templates + { + public static string FileTemplate = +@"// Attention: This file is generated. Any modifications will eventually be overwritten. + +using System; +using System.Collections.Generic; +using System.Text; +using Semiodesk.Trinity; + +namespace {1} +{{ + {0} +}}"; + + public static string OntologyTemplate = +@" +/// +///{3} +///{4} +/// +public class {0} : Ontology +{{ + public static readonly Uri Namespace = new Uri(""{1}""); + public static Uri GetNamespace() {{ return Namespace; }} + + public static readonly string Prefix = ""{0}""; + public static string GetPrefix() {{ return Prefix; }} {2} +}}"; + + public static string ResourceTemplate = + @" + + /// + ///{3} + /// + public static readonly {0} {1} = new {0}(new Uri(""{2}"")); +"; + + public static string StringOntologyTemplate = +@" +/// +///{3} +///{4} +/// +public static class {0} +{{ + public static readonly Uri Namespace = new Uri(""{1}""); + public static Uri GetNamespace() {{ return Namespace; }} + + public static readonly string Prefix = ""{0}""; + public static string GetPrefix() {{ return Prefix; }} {2} +}} +"; + + public static string StringTemplate = @" + + /// + ///{3} + /// + public const string {1} = ""{2}"";"; + } +} \ No newline at end of file diff --git a/Trinity.OntologyGenerator/Trinity.OntologyGenerator.csproj b/Trinity.OntologyGenerator/Trinity.OntologyGenerator.csproj index 62483d4..3f4747f 100644 --- a/Trinity.OntologyGenerator/Trinity.OntologyGenerator.csproj +++ b/Trinity.OntologyGenerator/Trinity.OntologyGenerator.csproj @@ -39,6 +39,12 @@ Semiodesk.Trinity.OntologyGenerator.Program + + ..\packages\dotNetRDF.2.7.0\lib\net40\dotNetRDF.dll + + + ..\packages\HtmlAgilityPack.1.11.31\lib\Net45\HtmlAgilityPack.dll + ..\packages\Microsoft.Build.Framework.16.6.0\lib\netstandard2.0\Microsoft.Build.Framework.dll @@ -48,6 +54,9 @@ ..\packages\Microsoft.Win32.Registry.5.0.0\lib\net461\Microsoft.Win32.Registry.dll + + ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll @@ -85,6 +94,7 @@ ..\packages\System.Text.Encoding.CodePages.5.0.0\lib\net461\System.Text.Encoding.CodePages.dll + @@ -93,6 +103,9 @@ + + ..\packages\VDS.Common.1.10.0\lib\net40-client\VDS.Common.dll + @@ -104,20 +117,10 @@ - - True - True - Resources.resx - Code - - - - ResXFileCodeGenerator - Resources.Designer.cs - + diff --git a/Trinity.OntologyGenerator/packages.config b/Trinity.OntologyGenerator/packages.config index 889e3b7..1291ecb 100644 --- a/Trinity.OntologyGenerator/packages.config +++ b/Trinity.OntologyGenerator/packages.config @@ -1,8 +1,10 @@  + + @@ -12,4 +14,6 @@ + + \ No newline at end of file