Skip to content

Commit 4270e50

Browse files
committed
// GuidOf...Actions
1 parent 42d52ae commit 4270e50

6 files changed

Lines changed: 114 additions & 2 deletions

File tree

Action/CorpusExplorer.Sdk.Action/CorpusExplorer.Sdk.Action.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@
136136
<Compile Include="Frequency1RawSelectAction.cs" />
137137
<Compile Include="Frequency2RawAction.cs" />
138138
<Compile Include="CentralSnipTreeAction.cs" />
139+
<Compile Include="GuidOfCorpusAction.cs" />
140+
<Compile Include="GuidOfDocumentAction.cs" />
141+
<Compile Include="GuidOfLayerAction.cs" />
142+
<Compile Include="GuidOfSelectionAction.cs" />
139143
<Compile Include="KwitFrequencyAction.cs" />
140144
<Compile Include="NGramCharAction.cs" />
141145
<Compile Include="Phrase2LayerCountAction.cs" />
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using CorpusExplorer.Sdk.Addon;
2+
using CorpusExplorer.Sdk.Model;
3+
using CorpusExplorer.Sdk.Utils.DataTableWriter.Abstract;
4+
using System.Data;
5+
6+
namespace CorpusExplorer.Sdk.Action
7+
{
8+
public class GuidOfCorpusAction : IAction
9+
{
10+
public string Action => "guid-of-corpus";
11+
public string Description => "guid-of-corpus - get name/guid-pairs of all corpora in selection";
12+
13+
public void Execute(Selection selection, string[] args, AbstractTableWriter writer)
14+
{
15+
var dt = new DataTable();
16+
dt.Columns.Add("Name", typeof(string));
17+
dt.Columns.Add("Guid", typeof(string));
18+
19+
dt.BeginLoadData();
20+
foreach(var x in selection.CorporaGuidsAndDisplaynames)
21+
dt.Rows.Add(x.Value, x.Key);
22+
dt.EndLoadData();
23+
24+
writer.WriteTable(dt);
25+
}
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System.Data;
2+
using CorpusExplorer.Sdk.Addon;
3+
using CorpusExplorer.Sdk.Model;
4+
using CorpusExplorer.Sdk.Utils.DataTableWriter.Abstract;
5+
6+
namespace CorpusExplorer.Sdk.Action
7+
{
8+
public class GuidOfDocumentAction : IAction
9+
{
10+
public string Action => "guid-of-document";
11+
public string Description => "guid-of-document - get title/guid-pairs of all documents (only if title is present as metadata)";
12+
13+
public void Execute(Selection selection, string[] args, AbstractTableWriter writer)
14+
{
15+
var dt = new DataTable();
16+
dt.Columns.Add("Name", typeof(string));
17+
dt.Columns.Add("Guid", typeof(string));
18+
19+
dt.BeginLoadData();
20+
foreach(var x in selection.DocumentGuidsAndDisplaynames)
21+
dt.Rows.Add(x.Value, x.Key);
22+
dt.EndLoadData();
23+
24+
writer.WriteTable(dt);
25+
}
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System.Data;
2+
using CorpusExplorer.Sdk.Addon;
3+
using CorpusExplorer.Sdk.Model;
4+
using CorpusExplorer.Sdk.Utils.DataTableWriter.Abstract;
5+
6+
namespace CorpusExplorer.Sdk.Action
7+
{
8+
public class GuidOfLayerAction : IAction
9+
{
10+
public string Action => "guid-of-layer";
11+
public string Description => "guid-of-layer - get name/guid-pairs of all layers";
12+
13+
public void Execute(Selection selection, string[] args, AbstractTableWriter writer)
14+
{
15+
var dt = new DataTable();
16+
dt.Columns.Add("Name", typeof(string));
17+
dt.Columns.Add("Guid", typeof(string));
18+
19+
dt.BeginLoadData();
20+
foreach(var x in selection.LayerGuidAndDisplaynames)
21+
dt.Rows.Add(x.Value, x.Key);
22+
dt.EndLoadData();
23+
24+
writer.WriteTable(dt);
25+
}
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System.Data;
2+
using CorpusExplorer.Sdk.Addon;
3+
using CorpusExplorer.Sdk.Model;
4+
using CorpusExplorer.Sdk.Utils.DataTableWriter.Abstract;
5+
6+
namespace CorpusExplorer.Sdk.Action
7+
{
8+
public class GuidOfSelectionAction : IAction
9+
{
10+
public string Action => "guid-of-selection";
11+
public string Description => "guid-of-selection - get name/guid-pair of the current selection (note: temporary in cluster)";
12+
13+
public void Execute(Selection selection, string[] args, AbstractTableWriter writer)
14+
{
15+
var dt = new DataTable();
16+
dt.Columns.Add("Name", typeof(string));
17+
dt.Columns.Add("Guid", typeof(string));
18+
19+
dt.BeginLoadData();
20+
foreach(var x in selection.CorporaGuidsAndDisplaynames)
21+
dt.Rows.Add(x.Value, x.Key);
22+
dt.EndLoadData();
23+
24+
writer.WriteTable(dt);
25+
}
26+
}
27+
}

DotNet5/CorpusExplorer.Terminal.Console.DotNet5/CorpusExplorer.Terminal.Console.DotNet5.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@
8585
<PackageReference Include="K4os.Compression.LZ4" Version="1.3.8" />
8686
<PackageReference Include="K4os.Compression.LZ4.Streams" Version="1.3.8" />
8787
<PackageReference Include="K4os.Hash.xxHash" Version="1.0.8" />
88-
<PackageReference Include="Microsoft.OpenApi" Version="2.0.0" />
88+
<PackageReference Include="Microsoft.OpenApi" Version="1.6.24" />
8989
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
9090
<PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
91-
<PackageReference Include="System.Security.Permissions" Version="9.0.7" />
91+
<PackageReference Include="System.Security.Permissions" Version="9.0.6" />
9292
</ItemGroup>
9393

9494
<ItemGroup>

0 commit comments

Comments
 (0)