-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
03e4716
commit e300f33
Showing
27 changed files
with
198 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/Serval/src/Serval.DataFiles/Contracts/DataFileReferenceDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Serval.DataFiles.Contracts; | ||
|
||
public record DataFileReferenceDto | ||
{ | ||
public required string Id { get; init; } | ||
public required string Url { get; init; } | ||
public string? Name { get; init; } | ||
public required FileFormat Format { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Serval.DataFiles.Models; | ||
|
||
public record DataFileReference | ||
{ | ||
public string Id { get; set; } = ""; | ||
public required string Name { get; init; } | ||
public required FileFormat Format { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
namespace Serval.Shared.Models; | ||
|
||
public record CorpusFile | ||
{ | ||
public required string Id { get; set; } | ||
public required FileFormat Format { get; set; } | ||
public required string TextId { get; set; } | ||
|
||
private string? _filename; | ||
|
||
public async Task<string> PopulateFilenameAsync( | ||
IRequestClient<GetDataFile> getDataFileClient, | ||
string owner, | ||
CancellationToken cancellationToken | ||
) | ||
{ | ||
Response<DataFileResult, DataFileNotFound> response = await getDataFileClient.GetResponse< | ||
DataFileResult, | ||
DataFileNotFound | ||
>(new GetDataFile { DataFileId = Id, Owner = owner }, cancellationToken); | ||
if (response.Is(out Response<DataFileResult>? result)) | ||
{ | ||
_filename = result.Message.Filename; | ||
} | ||
throw new InvalidOperationException($"The data file {Id} cannot be found."); | ||
} | ||
|
||
public string GetFilename() | ||
{ | ||
return _filename | ||
?? throw new InvalidOperationException( | ||
"The filename has not been populated. It is not stored in the database." | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace Serval.Shared.Models; | ||
|
||
public record MonolingualCorpus | ||
{ | ||
public required string Id { get; set; } | ||
public string? Name { get; set; } | ||
public required string Language { get; set; } | ||
public required IReadOnlyList<CorpusFile> Files { get; set; } | ||
|
||
public async Task PopulateFilenamesAsync( | ||
IRequestClient<GetDataFile> getDataFileClient, | ||
string owner, | ||
CancellationToken cancellationToken | ||
) | ||
{ | ||
await Task.WhenAll( | ||
Files.Select(file => file.PopulateFilenameAsync(getDataFileClient, owner, cancellationToken)) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.