Skip to content

Commit

Permalink
Merge branch 'release/3.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Kieranties committed Feb 21, 2022
2 parents be5b92a + caea37c commit 5686dc1
Show file tree
Hide file tree
Showing 26 changed files with 341 additions and 37 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @CluedIn-io/Back-End
27 changes: 17 additions & 10 deletions CluedIn.Enricher.KnowledgeGraph.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28803.452
# Visual Studio Version 17
VisualStudioVersion = 17.0.32014.148
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B2A52533-7FBF-41FE-A0AF-874FC54300B2}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -21,9 +21,9 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{E1A76004-11EB-44E0-B1D2-B197689E9265}"
ProjectSection(SolutionItems) = preProject
azure-pipelines.yml = azure-pipelines.yml
global.json = global.json
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
global.json = global.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9BD54E81-D9C8-4419-82B8-8EE6CC7E2647}"
Expand All @@ -48,24 +48,30 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Git", "Git", "{17EE3C8D-BAE
.gitignore = .gitignore
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExternalSearch.Providers.KnowledgeGraph", "src\ExternalSearch.Providers.KnowledgeGraph.csproj", "{FAAD6DC5-6B35-4D73-AD98-8D2C3D86FEA4}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExternalSearch.KnowledgeGraph.Integration.Tests", "test\integration\ExternalSearch.KnowledgeGraph.Integration.Tests\ExternalSearch.KnowledgeGraph.Integration.Tests.csproj", "{E4418764-F1EF-40D3-AA8C-C2C6C38B6654}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExternalSearch.Providers.KnowledgeGraph", "src\ExternalSearch.Providers.KnowledgeGraph\ExternalSearch.Providers.KnowledgeGraph.csproj", "{AC2E917B-214A-4BB1-8FAB-3116A89AD94C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExternalSearch.KnowledgeGraph.Integration.Tests", "test\integration\ExternalSearch.KnowledgeGraph.Integration.Tests\ExternalSearch.KnowledgeGraph.Integration.Tests.csproj", "{E4418764-F1EF-40D3-AA8C-C2C6C38B6654}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Provider.ExternalSearch.KnowledgeGraph", "src\ExternalSearch.Providers.KnowledgeGraph.Provider\Provider.ExternalSearch.KnowledgeGraph.csproj", "{3127354F-F2CA-4384-956D-2539C01422A9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FAAD6DC5-6B35-4D73-AD98-8D2C3D86FEA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FAAD6DC5-6B35-4D73-AD98-8D2C3D86FEA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FAAD6DC5-6B35-4D73-AD98-8D2C3D86FEA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FAAD6DC5-6B35-4D73-AD98-8D2C3D86FEA4}.Release|Any CPU.Build.0 = Release|Any CPU
{E4418764-F1EF-40D3-AA8C-C2C6C38B6654}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E4418764-F1EF-40D3-AA8C-C2C6C38B6654}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E4418764-F1EF-40D3-AA8C-C2C6C38B6654}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E4418764-F1EF-40D3-AA8C-C2C6C38B6654}.Release|Any CPU.Build.0 = Release|Any CPU
{AC2E917B-214A-4BB1-8FAB-3116A89AD94C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AC2E917B-214A-4BB1-8FAB-3116A89AD94C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AC2E917B-214A-4BB1-8FAB-3116A89AD94C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AC2E917B-214A-4BB1-8FAB-3116A89AD94C}.Release|Any CPU.Build.0 = Release|Any CPU
{3127354F-F2CA-4384-956D-2539C01422A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3127354F-F2CA-4384-956D-2539C01422A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3127354F-F2CA-4384-956D-2539C01422A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3127354F-F2CA-4384-956D-2539C01422A9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -78,8 +84,9 @@ Global
{02641789-0D38-4DBB-9288-23592CF55D25} = {9BD54E81-D9C8-4419-82B8-8EE6CC7E2647}
{2C3AECCF-DCB5-4ED7-8B7B-8F373EDE3A5E} = {9BD54E81-D9C8-4419-82B8-8EE6CC7E2647}
{17EE3C8D-BAE4-481A-B9CC-1BE878E86124} = {9BD54E81-D9C8-4419-82B8-8EE6CC7E2647}
{FAAD6DC5-6B35-4D73-AD98-8D2C3D86FEA4} = {B2A52533-7FBF-41FE-A0AF-874FC54300B2}
{E4418764-F1EF-40D3-AA8C-C2C6C38B6654} = {DBD1964B-DBD9-4C70-96CA-391C34B3D75F}
{AC2E917B-214A-4BB1-8FAB-3116A89AD94C} = {B2A52533-7FBF-41FE-A0AF-874FC54300B2}
{3127354F-F2CA-4384-956D-2539C01422A9} = {B2A52533-7FBF-41FE-A0AF-874FC54300B2}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6A61CB42-80C5-4A83-AC3E-DA41FC875525}
Expand Down
12 changes: 5 additions & 7 deletions Packages.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<Project>
<PropertyGroup Label="Dependency Versions">
<_AutoFixture>4.11.0</_AutoFixture>
<_CluedIn>3.2.0-*</_CluedIn>
<_CluedIn>3.3.0-*</_CluedIn>
</PropertyGroup>

<ItemGroup>
<!--
Specified versions for dependencies in test projects
Expand All @@ -21,9 +20,8 @@
<PackageReference Update="Xunit.SkippableFact" Version="1.3.12" />
<PackageReference Update="Moq" Version="4.13.1" />
<PackageReference Update="Shouldly" Version="3.0.2" />
<!-- <PackageReference Update="CluedIn.Testing.Base" Version="$(_CluedIn)" />-->
<!-- <PackageReference Update="CluedIn.Testing.Base" Version="$(_CluedIn)" />-->
</ItemGroup>

<ItemGroup>
<!--
Specified versions for dependencies across the solution
Expand All @@ -32,9 +30,9 @@
-->
<PackageReference Update="CluedIn.Core" Version="$(_CluedIn)" />
<PackageReference Update="CluedIn.ExternalSearch" Version="$(_CluedIn)" />

<PackageReference Update="CluedIn.Crawling.Acceptance" Version="$(_CluedIn)" />
<PackageReference Update="ComponentHost" Version="2.0.0" />
</ItemGroup>

<ItemGroup Label="Global tools">
<!--
Automatically added to each project with :
Expand All @@ -45,4 +43,4 @@
-->
<!-- <GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" /> -->
</ItemGroup>
</Project>
</Project>
11 changes: 2 additions & 9 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,7 @@ variables:

steps:

# Configure NuGet
- pwsh: |
@('develop','release','AzurePipelines') | ForEach-Object{
dotnet nuget update source $_ -p $env:NUGET_KEY -u VssSessionToken --configfile nuget.config
}
condition: and(succeeded(), variables['nuget.key'])
displayName: 'Add api token to access nuget artifacts'
env:
NUGET_KEY: $(nuget.key)
- task: NuGetAuthenticate@0
displayName: 'Authenticate with nuget'

- template: crawler.build.yml@templates
4 changes: 4 additions & 0 deletions docs/3.3.0-release-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Fixes

### Features
+ Implement Provider Model AB#5044
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System.Reflection;
using Castle.MicroKernel.Registration;
using CluedIn.Core;
using CluedIn.Core.Providers;
using CluedIn.Core.Server;
using CluedIn.ExternalSearch.Providers.KnowledgeGraph;
using ComponentHost;
using Constants = CluedIn.ExternalSearch.Providers.KnowledgeGraph.Constants;

namespace CluedIn.Provider.KnowledgeGraph
{
[Component(Constants.ComponentName, "Providers", ComponentType.Service, ServerComponents.ProviderWebApi, Components.Server, Components.DataStores, Isolation = ComponentIsolation.NotIsolated)]
public sealed class KnowledgeGraphProviderProviderComponent : ServiceApplicationComponent<IServer>
{
/**********************************************************************************************************
* CONSTRUCTOR
**********************************************************************************************************/

/// <summary>
/// Initializes a new instance of the <see cref="KnowledgeGraphProviderProviderComponent" /> class.
/// </summary>
/// <param name="componentInfo">The component information.</param>
public KnowledgeGraphProviderProviderComponent(ComponentInfo componentInfo) : base(componentInfo)
{
// Dev. Note: Potential for compiler warning here ... CA2214: Do not call overridable methods in constructors
// this class has been sealed to prevent the CA2214 waring being raised by the compiler
Container.Register(Component.For<KnowledgeGraphProviderProviderComponent>().Instance(this));
}

/**********************************************************************************************************
* METHODS
**********************************************************************************************************/

/// <summary>Starts this instance.</summary>
public override void Start()
{
var asm = Assembly.GetAssembly(typeof(KnowledgeGraphProviderProviderComponent));
Container.Register(Types.FromAssembly(asm).BasedOn<IProvider>().WithServiceFromInterface().If(t => !t.IsAbstract).LifestyleSingleton());

State = ServiceState.Started;
}

/// <summary>Stops this instance.</summary>
public override void Stop()
{
if (State == ServiceState.Stopped)
return;

State = ServiceState.Stopped;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CluedIn.Core;
using CluedIn.Core.Crawling;
using CluedIn.Core.Data.Relational;
using CluedIn.Core.ExternalSearch;
using CluedIn.Core.Providers;
using CluedIn.Core.Webhooks;
using CluedIn.ExternalSearch;
using CluedIn.ExternalSearch.Providers.KnowledgeGraph;
using CluedIn.Providers.Models;
using Constants = CluedIn.ExternalSearch.Providers.KnowledgeGraph.Constants;

namespace CluedIn.Provider.KnowledgeGraph
{
public class KnowledgeGraphSearchProviderProvider : ProviderBase, IExtendedProviderMetadata, IExternalSearchProviderProvider
{
public IExternalSearchProvider ExternalSearchProvider { get; }

public KnowledgeGraphSearchProviderProvider([System.Diagnostics.CodeAnalysis.NotNull] ApplicationContext appContext) : base(appContext, GetMetaData())
{
ExternalSearchProvider = appContext.Container.ResolveAll<IExternalSearchProvider>().Single(n => n.Id == Constants.ProviderId);
}

private static IProviderMetadata GetMetaData()
{
return new ProviderMetadata
{
Id = Constants.ProviderId,
Name = Constants.ProviderName,
ComponentName = Constants.ComponentName,
AuthTypes = new List<string>(),
SupportsConfiguration = true,
SupportsAutomaticWebhookCreation = false,
SupportsWebHooks = false,
Type = "Enricher"
};
}

public override async Task<CrawlJobData> GetCrawlJobData(ProviderUpdateContext context, IDictionary<string, object> configuration, Guid organizationId, Guid userId, Guid providerDefinitionId)
{
if (configuration == null)
throw new ArgumentNullException(nameof(configuration));

var result = new KnowledgeGraphExternalSearchJobData(configuration);

return await Task.FromResult(result);
}

public override Task<bool> TestAuthentication(ProviderUpdateContext context, IDictionary<string, object> configuration, Guid organizationId, Guid userId, Guid providerDefinitionId)
{
return Task.FromResult(true);
}

public override Task<ExpectedStatistics> FetchUnSyncedEntityStatistics(Core.ExecutionContext context, IDictionary<string, object> configuration, Guid organizationId, Guid userId, Guid providerDefinitionId)
{
throw new NotImplementedException();
}


public override async Task<IDictionary<string, object>> GetHelperConfiguration(ProviderUpdateContext context, CrawlJobData jobData, Guid organizationId, Guid userId, Guid providerDefinitionId)
{
if (jobData is KnowledgeGraphExternalSearchJobData result)
{
return await Task.FromResult(result.ToDictionary());
}

throw new InvalidOperationException($"Unexpected data type for KnowledgeGraphExternalSearchJobData, {jobData.GetType()}");
}

public override Task<IDictionary<string, object>> GetHelperConfiguration(ProviderUpdateContext context, CrawlJobData jobData, Guid organizationId, Guid userId, Guid providerDefinitionId, string folderId)
{
return GetHelperConfiguration(context, jobData, organizationId, userId, providerDefinitionId);
}

public override Task<AccountInformation> GetAccountInformation(Core.ExecutionContext context, CrawlJobData jobData, Guid organizationId, Guid userId, Guid providerDefinitionId)
{
return Task.FromResult(new AccountInformation(providerDefinitionId.ToString(), providerDefinitionId.ToString()));
}

public override string Schedule(DateTimeOffset relativeDateTime, bool webHooksEnabled)
{
return $"{relativeDateTime.Minute} 0/23 * * *";
}

public override Task<IEnumerable<WebHookSignature>> CreateWebHook(Core.ExecutionContext context, CrawlJobData jobData, IWebhookDefinition webhookDefinition, IDictionary<string, object> config)
{
throw new NotImplementedException();
}

public override Task<IEnumerable<WebhookDefinition>> GetWebHooks(Core.ExecutionContext context)
{
throw new NotImplementedException();
}

public override Task DeleteWebHook(Core.ExecutionContext context, CrawlJobData jobData, IWebhookDefinition webhookDefinition)
{
throw new NotImplementedException();
}

public override Task<CrawlLimit> GetRemainingApiAllowance(Core.ExecutionContext context, CrawlJobData jobData, Guid organizationId, Guid userId, Guid providerDefinitionId)
{
if (jobData == null) throw new ArgumentNullException(nameof(jobData));
return Task.FromResult(new CrawlLimit(-1, TimeSpan.Zero));
}

public override IEnumerable<string> WebhookManagementEndpoints(IEnumerable<string> ids)
{
throw new NotImplementedException();
}

public override bool ScheduleCrawlJobs => false;
public string Icon { get; } = Constants.Icon;
public string Domain { get; } = Constants.Domain;
public string About { get; } = Constants.About;
public AuthMethods AuthMethods { get; } = Constants.AuthMethods;
public IEnumerable<Control> Properties { get; } = Constants.Properties;
public Guide Guide { get; } = Constants.Guide;
public new IntegrationType Type { get; } = Constants.IntegrationType;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="CluedIn.Core" />
<PackageReference Include="ComponentHost" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ExternalSearch.Providers.KnowledgeGraph\ExternalSearch.Providers.KnowledgeGraph.csproj" />
</ItemGroup>

</Project>
41 changes: 41 additions & 0 deletions src/ExternalSearch.Providers.KnowledgeGraph/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using CluedIn.Core.Data.Relational;
using CluedIn.Core.Providers;

namespace CluedIn.ExternalSearch.Providers.KnowledgeGraph
{
public static class Constants
{
public const string ComponentName = "KnowledgeGraph";
public const string ProviderName = "Knowledge Graph";
public static readonly Guid ProviderId = Core.Constants.ExternalSearchProviders.GoogleKnowledgeGraphId;

public static string About { get; set; } = "Knowledge Graph is an enricher which allows you to find entities using the Google Knowledge Graph API";
public static string Icon { get; set; } = "Resources.knowledge_graph.svg";
public static string Domain { get; set; } = "https://developers.google.com/knowledge-graph";

public static AuthMethods AuthMethods { get; set; } = new AuthMethods
{
token = new List<Control>()
{

}
};

public static IEnumerable<Control> Properties { get; set; } = new List<Control>()
{
// NOTE: Leaving this commented as an example - BF
//new()
//{
// displayName = "Some Data",
// type = "input",
// isRequired = true,
// name = "someData"
//}
};

public static Guide Guide { get; set; } = null;
public static IntegrationType IntegrationType { get; set; } = IntegrationType.Enrichment;
}
}
20 changes: 20 additions & 0 deletions src/ExternalSearch.Providers.KnowledgeGraph/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project>
<Import Project="..\Directory.Build.props" />

<PropertyGroup>
<IsTestProject>false</IsTestProject>
</PropertyGroup>

<PropertyGroup>

<!-- <RepositoryUrl>TODO</RepositoryUrl> -->
<RepositoryType>git</RepositoryType>
<PublishRepositoryUrl>true</PublishRepositoryUrl>

<!-- Legacy NuGet symbols format, ref: https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg -->
<SymbolPackageFormat>symbols.nupkg</SymbolPackageFormat>
<IncludeSymbols>true</IncludeSymbols>

</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<None Remove="Resources\knowledgegraph.jpg" />
<None Remove="Resources\knowledge_graph.svg" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\knowledgegraph.jpg" />
<EmbeddedResource Include="Resources\knowledge_graph.svg" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CluedIn.ExternalSearch" />
Expand Down
Loading

0 comments on commit 5686dc1

Please sign in to comment.