Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • Issue/1788-extractionCronjob
  • Issue/1792-newMetadataStructure
  • Issue/2518-docs
  • Issue/2769-migrateCron
  • dev
  • gitkeep
  • main
  • test
  • v0.1.0
  • v0.1.1
  • v0.1.10
  • v0.1.11
  • v0.1.2
  • v0.1.3
  • v0.1.4
  • v0.1.5
  • v0.1.6
  • v0.1.7
  • v0.1.8
  • v0.1.9
20 results

Target

Select target project
  • coscine/backend/scripts/metadataextractorcron
1 result
Select Git revision
  • Issue/1788-extractionCronjob
  • Issue/1792-newMetadataStructure
  • Issue/2518-docs
  • Issue/2769-migrateCron
  • dev
  • gitkeep
  • main
  • test
  • v0.1.0
  • v0.1.1
  • v0.1.10
  • v0.1.11
  • v0.1.2
  • v0.1.3
  • v0.1.4
  • v0.1.5
  • v0.1.6
  • v0.1.7
  • v0.1.8
  • v0.1.9
20 results
Show changes
Showing
with 638 additions and 1035 deletions
......@@ -3,15 +3,16 @@
*
* This API extracts RDF triples from files
*
* The version of the OpenAPI document: 0.1.1
* The version of the OpenAPI document: 0.4.3
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace Org.OpenAPITools.Model
namespace Coscine.MetadataExtractor.Core.Model
{
/// <summary>
/// Abstract base class for oneOf, anyOf schemas in the OpenAPI specification
......
......@@ -3,16 +3,27 @@
*
* This API extracts RDF triples from files
*
* The version of the OpenAPI document: 0.1.1
* The version of the OpenAPI document: 0.4.3
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Coscine.MetadataExtractor.Core.Client.OpenAPIDateConverter;
namespace Org.OpenAPITools.Model
namespace Coscine.MetadataExtractor.Core.Model
{
/// <summary>
/// MetadataOutput
......@@ -144,7 +155,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
......
......@@ -3,37 +3,48 @@
*
* This API extracts RDF triples from files
*
* The version of the OpenAPI document: 0.1.1
* The version of the OpenAPI document: 0.4.3
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Coscine.MetadataExtractor.Core.Client.OpenAPIDateConverter;
namespace Org.OpenAPITools.Model
namespace Coscine.MetadataExtractor.Core.Model
{
/// <summary>
/// ModelVersion
/// </summary>
[DataContract(Name = "_Version")]
[DataContract(Name = "varVersion")]
public partial class ModelVersion : IEquatable<ModelVersion>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="ModelVersion" /> class.
/// </summary>
/// <param name="version">version.</param>
public ModelVersion(string version = default(string))
/// <param name="varVersion">varVersion.</param>
public ModelVersion(string varVersion = default(string))
{
this._Version = version;
this.VarVersion = varVersion;
}
/// <summary>
/// Gets or Sets _Version
/// Gets or Sets VarVersion
/// </summary>
[DataMember(Name = "version", EmitDefaultValue = false)]
public string _Version { get; set; }
public string VarVersion { get; set; }
/// <summary>
/// Returns the string presentation of the object
......@@ -43,7 +54,7 @@ namespace Org.OpenAPITools.Model
{
StringBuilder sb = new StringBuilder();
sb.Append("class ModelVersion {\n");
sb.Append(" _Version: ").Append(_Version).Append("\n");
sb.Append(" VarVersion: ").Append(VarVersion).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
......@@ -80,9 +91,9 @@ namespace Org.OpenAPITools.Model
}
return
(
this._Version == input._Version ||
(this._Version != null &&
this._Version.Equals(input._Version))
this.VarVersion == input.VarVersion ||
(this.VarVersion != null &&
this.VarVersion.Equals(input.VarVersion))
);
}
......@@ -95,9 +106,9 @@ namespace Org.OpenAPITools.Model
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this._Version != null)
if (this.VarVersion != null)
{
hashCode = (hashCode * 59) + this._Version.GetHashCode();
hashCode = (hashCode * 59) + this.VarVersion.GetHashCode();
}
return hashCode;
}
......@@ -108,7 +119,7 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
......
......@@ -5,7 +5,7 @@ VisualStudioVersion = 17.1.32414.318
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MetadataExtractorCron", "MetadataExtractorCron\MetadataExtractorCron.csproj", "{B76A7422-1D0F-491F-B71C-D00E7C885C4A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenApiGeneratedConnector", "OpenApiGeneratedConnector\OpenApiGeneratedConnector.csproj", "{6FAAF00B-335B-4896-826F-06CA79CAA2E0}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Coscine.MetadataExtractor.Core", "Coscine.MetadataExtractor.Core\Coscine.MetadataExtractor.Core.csproj", "{7260DEF1-77FC-4DEF-8EB4-9502B334DE6C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......@@ -17,10 +17,10 @@ Global
{B76A7422-1D0F-491F-B71C-D00E7C885C4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B76A7422-1D0F-491F-B71C-D00E7C885C4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B76A7422-1D0F-491F-B71C-D00E7C885C4A}.Release|Any CPU.Build.0 = Release|Any CPU
{6FAAF00B-335B-4896-826F-06CA79CAA2E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6FAAF00B-335B-4896-826F-06CA79CAA2E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6FAAF00B-335B-4896-826F-06CA79CAA2E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6FAAF00B-335B-4896-826F-06CA79CAA2E0}.Release|Any CPU.Build.0 = Release|Any CPU
{7260DEF1-77FC-4DEF-8EB4-9502B334DE6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7260DEF1-77FC-4DEF-8EB4-9502B334DE6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7260DEF1-77FC-4DEF-8EB4-9502B334DE6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7260DEF1-77FC-4DEF-8EB4-9502B334DE6C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -2,20 +2,25 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.1.10</Version></PropertyGroup>
<Version>0.1.11</Version></PropertyGroup>
<ItemGroup>
<PackageReference Include="Coscine.Database" Version="*-*" />
<PackageReference Include="Coscine.Metadata" Version="2.9.0" />
<PackageReference Include="Coscine.ResourceTypes" Version="*-*" />
<PackageReference Include="dotNetRDF" Version="2.7.5" />
<PackageReference Include="Coscine.ApiClient" Version="1.8.0-issue-2769-migra0018" />
<PackageReference Include="dotNetRDF" Version="3.1.1" />
<PackageReference Include="NLog" Version="5.2.8" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenApiGeneratedConnector\OpenApiGeneratedConnector.csproj" />
<ProjectReference Include="..\Coscine.MetadataExtractor.Core\Coscine.MetadataExtractor.Core.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="nlog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
namespace MetadataExtractorCron.Models.ConfigurationModels;
/// <summary>
/// Represents the configuration settings used in the application.
/// </summary>
public class MetadataExtractorConfiguration
{
/// <summary>
/// The section name in the configuration file.
/// </summary>
public static readonly string Section = "MetadataExtractorConfiguration";
/// <summary>
/// Value indicating whether Metadata Extraction is enabled.
/// </summary>
public bool IsEnabled { get; init; } = true;
/// <summary>
/// Url of the metadata extraction service.
/// </summary>
public string MetadataExtractionUrl { get; init; } = "https://metadataextractor.otc.coscine.dev/";
/// <summary>
/// The maximum file size for research data which should be analyzed by e.g. Metadata Extractor or Tracker
/// </summary>
public long DetectionByteLimit { get; init; } = 16 * 1000 * 1000L;
/// <summary>
/// Logger configuration settings.
/// </summary>
/// <value>
/// The logger storage configuration settings, or <c>null</c> if not configured.
/// </value>
public LoggerConfiguration? Logger { get; init; }
/// <summary>
/// Represents the configuration settings for the logger.
/// </summary>
public record LoggerConfiguration(string? LogLevel, string? LogHome);
}
using MetadataExtractorCron.Extractors;
using MetadataExtractorCron.Models.ConfigurationModels;
using Microsoft.Extensions.Configuration;
using NLog;
using Winton.Extensions.Configuration.Consul;
var metadataExtractor = new CoscineMetadataExtractor();
var configBuilder = new ConfigurationBuilder();
var consulUrl = Environment.GetEnvironmentVariable("CONSUL_URL") ?? "http://localhost:8500";
var configuration = configBuilder
.AddConsul(
"coscine/Coscine.Infrastructure/MetadataExtractorCron/appsettings",
options =>
{
options.ConsulConfigurationOptions =
cco => cco.Address = new Uri(consulUrl);
options.Optional = true;
options.ReloadOnChange = true;
options.PollWaitTime = TimeSpan.FromSeconds(5);
options.OnLoadException = exceptionContext => exceptionContext.Ignore = true;
}
)
.AddEnvironmentVariables()
.Build();
var metadataExtractorConfiguration = new MetadataExtractorConfiguration();
configuration.Bind(MetadataExtractorConfiguration.Section, metadataExtractorConfiguration);
// Set the default LogLevel
LogManager.Configuration.Variables["logLevel"] = metadataExtractorConfiguration.Logger?.LogLevel ?? "Trace";
// Set the log location
LogManager.Configuration.Variables["logHome"] = metadataExtractorConfiguration.Logger?.LogHome ?? Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs");
var logger = LogManager.GetCurrentClassLogger();
if (!metadataExtractorConfiguration.IsEnabled)
{
logger.Info("Disabled, skipped run.");
return;
}
try
{
var metadataExtractor = new CoscineMetadataExtractor(metadataExtractorConfiguration);
await metadataExtractor.PerformExtraction();
}
catch (Exception e)
{
logger.Info("Aborted on error.");
logger.Error(e);
return;
}
Console.WriteLine("Finished.");
\ No newline at end of file
logger.Info("Finished successfully.");
using Coscine.Metadata;
using VDS.RDF;
namespace MetadataExtractorCron.Util;
public static class GraphStorer
{
public static void StoreGraphs(IEnumerable<IGraph> graphUris, RdfStoreConnector rdfStoreConnector)
{
foreach (var graphUri in graphUris)
{
rdfStoreConnector.AddGraph(graphUri);
}
}
public static void AddToGraph(IGraph graph, IEnumerable<Triple> triples, RdfStoreConnector rdfStoreConnector)
{
Console.WriteLine($" - Adding Triples to {graph.BaseUri}");
rdfStoreConnector.AddToGraph(graph, triples);
Console.WriteLine($" - Triples added to Graph {graph.BaseUri} successfully");
Console.WriteLine();
}
}
\ No newline at end of file
using System.Security.Cryptography;
namespace MetadataExtractorCron.Util
{
/// <summary>
/// Provides utility functions to calculate hashes of research data
/// </summary>
public static class HashUtil
{
/// <summary>
/// The default hash algorithm being used (SHA512)
/// </summary>
public static HashAlgorithmName DefaultHashAlgorithm => HashAlgorithmName.SHA512;
private static HashAlgorithm GetHashAlgorithm(HashAlgorithmName hashAlgorithmName)
{
if (hashAlgorithmName == HashAlgorithmName.MD5)
return MD5.Create();
if (hashAlgorithmName == HashAlgorithmName.SHA1)
return SHA1.Create();
if (hashAlgorithmName == HashAlgorithmName.SHA256)
return SHA256.Create();
if (hashAlgorithmName == HashAlgorithmName.SHA384)
return SHA384.Create();
if (hashAlgorithmName == HashAlgorithmName.SHA512)
return SHA512.Create();
throw new CryptographicException($"Unknown hash algorithm \"{hashAlgorithmName.Name}\".");
}
/// <summary>
/// Takes a data stream and returns a hash represnetation of it
/// </summary>
/// <param name="data"></param>
/// <param name="hashAlgorithmName"></param>
/// <returns></returns>
public static byte[] HashData(Stream data, HashAlgorithmName? hashAlgorithmName = null)
{
hashAlgorithmName ??= DefaultHashAlgorithm;
using var hashAlgorithmObject = GetHashAlgorithm(hashAlgorithmName.Value);
return hashAlgorithmObject.ComputeHash(data);
}
}
}
namespace MetadataExtractor.Util
{
/// <summary>
/// Utility for determining versions
/// </summary>
public static class VersionUtil
{
/// <summary>
/// Receives the recent version by the given parameters
/// </summary>
/// <param name="graphs"></param>
/// <param name="filter"></param>
/// <param name="notFilterExtracted"></param>
/// <returns></returns>
public static Uri? GetRecentVersion(IEnumerable<Uri>? graphs, string? filter = null, bool notFilterExtracted = true)
{
if (graphs is null)
{
return null;
}
var recentVersion = GetRecentVersion(graphs.Select((graph) => graph.AbsoluteUri), filter, notFilterExtracted);
if (recentVersion is not null)
{
return new Uri(recentVersion);
}
return null;
}
/// <summary>
/// Receives the recent version by the given parameters
/// </summary>
/// <param name="graphs"></param>
/// <param name="filter"></param>
/// <param name="notFilterExtracted"></param>
/// <returns></returns>
public static string? GetRecentVersion(IEnumerable<string>? graphs, string? filter = null, bool notFilterExtracted = true)
{
if (graphs is null)
{
return null;
}
string? currentBest = null;
var currentBestVersion = -1L;
foreach (var graph in graphs)
{
var queryDictionary = System.Web.HttpUtility.ParseQueryString(
new Uri(graph.Replace("@", "?")).Query);
var version = queryDictionary["version"];
if (version is null || !long.TryParse(version, out long longVersion))
{
continue;
}
if (longVersion > currentBestVersion
&& (filter is null || queryDictionary["type"] == filter)
&& ((notFilterExtracted && queryDictionary["extracted"] is null)
|| (!notFilterExtracted && queryDictionary["extracted"] is not null))
)
{
currentBestVersion = longVersion;
currentBest = graph;
}
}
return currentBest;
}
/// <summary>
/// Receives the recent data version by the given parameters
/// </summary>
/// <param name="graphs"></param>
/// <returns></returns>
public static Uri? GetRecentDataVersion(IEnumerable<Uri>? graphs)
{
return GetRecentVersion(graphs, "data");
}
/// <summary>
/// Receives the recent data version by the given parameters
/// </summary>
/// <param name="graphs"></param>
/// <returns></returns>
public static string? GetRecentDataVersion(IEnumerable<string>? graphs)
{
return GetRecentVersion(graphs, "data");
}
/// <summary>
/// Receives the recent extracted data version by the given parameters
/// </summary>
/// <param name="graphs"></param>
/// <returns></returns>
public static Uri? GetRecentDataExtractedVersion(IEnumerable<Uri> graphs)
{
return GetRecentVersion(graphs, "data", false);
}
/// <summary>
/// Receives the recent extracted data version by the given parameters
/// </summary>
/// <param name="graphs"></param>
/// <returns></returns>
public static string? GetRecentDataExtractedVersion(IEnumerable<string> graphs)
{
return GetRecentVersion(graphs, "data", false);
}
/// <summary>
/// Receives the recent metadata version by the given parameters
/// </summary>
/// <param name="graphs"></param>
/// <returns></returns>
public static Uri? GetRecentMetadataVersion(IEnumerable<Uri>? graphs)
{
return GetRecentVersion(graphs, "metadata");
}
/// <summary>
/// Receives the recent metadata version by the given parameters
/// </summary>
/// <param name="graphs"></param>
/// <returns></returns>
public static string? GetRecentMetadataVersion(IEnumerable<string>? graphs)
{
return GetRecentVersion(graphs, "metadata");
}
/// <summary>
/// Receives the recent extracted metadata version by the given parameters
/// </summary>
/// <param name="graphs"></param>
/// <returns></returns>
public static Uri? GetRecentMetadataExtractedVersion(IEnumerable<Uri>? graphs)
{
return GetRecentVersion(graphs, "metadata", false);
}
/// <summary>
/// Receives the recent extracted metadata version by the given parameters
/// </summary>
/// <param name="graphs"></param>
/// <returns></returns>
public static string? GetRecentMetadataExtractedVersion(IEnumerable<string>? graphs)
{
return GetRecentVersion(graphs, "metadata", false);
}
/// <summary>
/// Creates a new version with the current timestamp
/// </summary>
/// <returns></returns>
public static long GetNewVersion()
{
// UTC Timestamp
return CalculateVersion(DateTime.UtcNow);
}
/// <summary>
/// Calculates a new version based on the given timestamp
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static long CalculateVersion(DateTime dateTime)
{
return long.Parse(Convert.ToString((int)dateTime.Subtract(new DateTime(1970, 1, 1)).TotalSeconds));
}
/// <summary>
/// Gets the version from the given graphUri
/// </summary>
/// <param name="graphUri">string representation of the given graph uri</param>
/// <returns></returns>
public static long? GetVersion(string? graphUri)
{
if (graphUri is null)
{
return null;
}
var queryDictionary = System.Web.HttpUtility.ParseQueryString(
new Uri(graphUri.Replace("@", "?")).Query);
var version = queryDictionary["version"];
var couldParse = long.TryParse(version, out long longVersion);
return couldParse ? longVersion : null;
}
/// <summary>
/// Gets the version from the given graphUri
/// </summary>
/// <param name="graphUri"></param>
/// <returns></returns>
public static long? GetVersion(Uri? graphUri)
{
if (graphUri is null)
{
return null;
}
return GetVersion(graphUri.AbsoluteUri);
}
}
}
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="Warn"
internalLogFile=".\internal_logs\internallog.txt">
<variable name="logHome" value="${basedir}/Logs" />
<variable name="logLevel" value="Warn" />
<!--Possible aspnet- variables: https://nlog-project.org/config/?tab=layout-renderers&search=package:nlog.web-->
<variable name="layout" value="${longdate} | [${level:uppercase=true}] ${message} ${exception:format=tostring}" />
<extensions>
<!--Enable NLog.Web for ASP.NET Core.-->
<add assembly="NLog.Web.AspNetCore" />
</extensions>
<targets>
<!-- Write logs to File -->
<target xsi:type="FallbackGroup"
name="fileGroup">
<target
name="fullfile"
xsi:type="File"
layout="${var:layout}"
fileName="${var:logHome}/full_${shortdate}.log"
keepFileOpen="false"
archiveFileName="${var:logHome}/Archive/full_${shortdate}.log"
archiveNumbering="Sequence"
archiveEvery="Day"
maxArchiveFiles="7"
/>
</target>
<!-- Write colored logs to Console -->
<target name="consoleLog" xsi:type="ColoredConsole" layout="[${uppercase:${level}}]: ${message}">
<highlight-word text="[TRACE]" foregroundColor="DarkGray" />
<highlight-word text="[Debug]" foregroundColor="Gray" />
<highlight-word text="[INFO]" foregroundColor="Green" />
<highlight-word text="[WARN]" foregroundColor="Yellow" />
<highlight-word text="[ERROR]" foregroundColor="Red" />
<highlight-word text="[FATAL]" foregroundColor="DarkRed" backgroundColor="White" />
</target>
</targets>
<rules>
<!--All logs, including Microsoft-->
<logger name="*" minlevel="${var:logLevel}" writeTo="fullfile" />
<!--Skip non-critical Microsoft logs and so log only own logs (BlackHole).-->
<logger name="Microsoft.*" maxlevel="Info" final="true" />
<logger name="System.Net.Http.*" maxlevel="Info" final="true" />
<!--All logs, including from Microsoft, Level Info-->
<logger name="*" minlevel="${var:logLevel}" writeTo="consoleLog" />
</rules>
</nlog>
\ No newline at end of file
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.1.10</Version></PropertyGroup>
<ItemGroup>
<PackageReference Include="JsonSubTypes" Version="1.9.0" />
<PackageReference Include="Polly" Version="7.2.3" />
<PackageReference Include="RestSharp" Version="108.0.2" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
</ItemGroup>
</Project>
# Org.OpenAPITools - the C# library for the Metadata Extractor API
This API extracts RDF triples from files
This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: 0.1.1
- SDK version: 1.0.0
- Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen
<a name="frameworks-supported"></a>
## Frameworks supported
- .NET Core >=1.0
- .NET Framework >=4.6
- Mono/Xamarin >=vNext
<a name="dependencies"></a>
## Dependencies
- [RestSharp](https://www.nuget.org/packages/RestSharp) - 106.13.0 or later
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 13.0.1 or later
- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.8.0 or later
- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 5.0.0 or later
The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
```
Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package System.ComponentModel.Annotations
```
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742).
NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See [RestSharp#1406](https://github.com/restsharp/RestSharp/issues/1406).
<a name="installation"></a>
## Installation
Generate the DLL using your preferred tool (e.g. `dotnet build`)
Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces:
```csharp
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
```
<a name="usage"></a>
## Usage
To use the API client with a HTTP proxy, setup a `System.Net.WebProxy`
```csharp
Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;
```
<a name="getting-started"></a>
## Getting Started
```csharp
using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class Example
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://localhost";
var apiInstance = new DefaultApi(config);
try
{
apiInstance.GetConfigWorker();
}
catch (ApiException e)
{
Debug.Print("Exception when calling DefaultApi.GetConfigWorker: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
<a name="documentation-for-api-endpoints"></a>
## Documentation for API Endpoints
All URIs are relative to *http://localhost*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*DefaultApi* | [**GetConfigWorker**](docs/DefaultApi.md#getconfigworker) | **GET** /defaultConfig |
*DefaultApi* | [**GetVersionWorker**](docs/DefaultApi.md#getversionworker) | **GET** /version |
*DefaultApi* | [**PostMetadataExtractorWorker**](docs/DefaultApi.md#postmetadataextractorworker) | **POST** / |
<a name="documentation-for-models"></a>
## Documentation for Models
- [Model.MetadataOutput](docs/MetadataOutput.md)
- [Model.ModelVersion](docs/ModelVersion.md)
<a name="documentation-for-authorization"></a>
## Documentation for Authorization
All endpoints do not require authorization.
# auto-generated by OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator)
#
image: Visual Studio 2019
clone_depth: 1
build_script:
- dotnet build -c Release
- dotnet test -c Release
after_build:
- dotnet pack .\src\Org.OpenAPITools\Org.OpenAPITools.csproj -o ../../output -c Release --no-build
# Org.OpenAPITools.Api.DefaultApi
All URIs are relative to *http://localhost*
| Method | HTTP request | Description |
|--------|--------------|-------------|
| [**GetConfigWorker**](DefaultApi.md#getconfigworker) | **GET** /defaultConfig | |
| [**GetVersionWorker**](DefaultApi.md#getversionworker) | **GET** /version | |
| [**PostMetadataExtractorWorker**](DefaultApi.md#postmetadataextractorworker) | **POST** / | |
<a name="getconfigworker"></a>
# **GetConfigWorker**
> void GetConfigWorker ()
### Example
```csharp
using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class GetConfigWorkerExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://localhost";
var apiInstance = new DefaultApi(config);
try
{
apiInstance.GetConfigWorker();
}
catch (ApiException e)
{
Debug.Print("Exception when calling DefaultApi.GetConfigWorker: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the GetConfigWorkerWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
apiInstance.GetConfigWorkerWithHttpInfo();
}
catch (ApiException e)
{
Debug.Print("Exception when calling DefaultApi.GetConfigWorkerWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Success | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="getversionworker"></a>
# **GetVersionWorker**
> ModelVersion GetVersionWorker ()
### Example
```csharp
using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class GetVersionWorkerExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://localhost";
var apiInstance = new DefaultApi(config);
try
{
ModelVersion result = apiInstance.GetVersionWorker();
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DefaultApi.GetVersionWorker: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the GetVersionWorkerWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
ApiResponse<ModelVersion> response = apiInstance.GetVersionWorkerWithHttpInfo();
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DefaultApi.GetVersionWorkerWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**ModelVersion**](ModelVersion.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Success | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="postmetadataextractorworker"></a>
# **PostMetadataExtractorWorker**
> List&lt;MetadataOutput&gt; PostMetadataExtractorWorker (System.IO.Stream file, string identifier = null, string config = null, string creationDate = null, string modificationDate = null)
### Example
```csharp
using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class PostMetadataExtractorWorkerExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://localhost";
var apiInstance = new DefaultApi(config);
var file = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream |
var identifier = "identifier_example"; // string | File Identifier (optional)
var config = "config_example"; // string | Object defining the utilized configuration (try \\\"/defaultConfig\\\" to get the structure) (optional)
var creationDate = "creationDate_example"; // string | Creation Date (Time) (e.g. \\\"2022-09-15T09:27:17.3550000+02:00\\\") (optional)
var modificationDate = "modificationDate_example"; // string | Modification Date (Time) (e.g. \\\"2022-09-15T09:27:17.3550000+02:00\\\") (optional)
try
{
List<MetadataOutput> result = apiInstance.PostMetadataExtractorWorker(file, identifier, config, creationDate, modificationDate);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DefaultApi.PostMetadataExtractorWorker: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the PostMetadataExtractorWorkerWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
ApiResponse<List<MetadataOutput>> response = apiInstance.PostMetadataExtractorWorkerWithHttpInfo(file, identifier, config, creationDate, modificationDate);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DefaultApi.PostMetadataExtractorWorkerWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **file** | **System.IO.Stream****System.IO.Stream** | | |
| **identifier** | **string** | File Identifier | [optional] |
| **config** | **string** | Object defining the utilized configuration (try \\\&quot;/defaultConfig\\\&quot; to get the structure) | [optional] |
| **creationDate** | **string** | Creation Date (Time) (e.g. \\\&quot;2022-09-15T09:27:17.3550000+02:00\\\&quot;) | [optional] |
| **modificationDate** | **string** | Modification Date (Time) (e.g. \\\&quot;2022-09-15T09:27:17.3550000+02:00\\\&quot;) | [optional] |
### Return type
[**List&lt;MetadataOutput&gt;**](MetadataOutput.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **400** | Bad Request | - |
| **200** | Success | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# Org.OpenAPITools.Model.MetadataOutput
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Identifier** | **string** | | [optional]
**Metadata** | **string** | | [optional]
**Text** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
# Org.OpenAPITools.Model.ModelVersion
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_Version** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)