Skip to content

Commit

Permalink
Adjust for Data Conveyer 3.1.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
mavidian committed Jun 16, 2019
1 parent 4772cef commit 24e4041
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DataConveyer" Version="3.0.1" />
<PackageReference Include="DataConveyer" Version="3.1.0" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions DataConveyer_AggregateTokens/FileProcessor.cs
Expand Up @@ -32,7 +32,7 @@ internal FileProcessor(string inLocation, string outFile)
GlobalCacheElements = new string[] { "TokenSummary" }, //a single element - a dictionary - Dict<string,Tuple<int,int>>
InputDataKind = KindOfTextData.XML,
IntakeReaders = () => Directory.GetFiles(_inLocation, "*.xml").Select(f => File.OpenText(f)), //note that we're neglecting to dispose the stream readers here (not a production code)
XmlJsonIntakeSettings = "RecordNode|Token,IncludeExplicitText|true",
XmlJsonIntakeSettings = "RecordNode|Token,IncludeExplicitText|true,IncludeAttributes|true",
ExplicitTypeDefinitions = "__explicitText__|I", //in our case, explicit text in Token node contains integer value
ClusterMarker = (rec,pRec,n) => pRec == null ? true : rec.SourceNo != pRec.SourceNo, // each file (source) constitutes a cluster
MarkerStartsCluster = true, //predicate (marker) matches the first record in cluster
Expand Down Expand Up @@ -103,7 +103,7 @@ private IEnumerable<ICluster> CumulateTokenData(ICluster cluster)
//Regular cluster - cumulate data in the global cache
foreach (var rec in cluster.Records)
{
var color = (string)rec["color"];
var color = (string)rec["@color"]; //keys originating from attributes are prepended with @ (by default)
var value = (int)rec["__explicitText__"];

tokenSummary.AddOrUpdate(color, (1, value), (c, t) => (t.count + 1, t.total + value));
Expand Down
2 changes: 1 addition & 1 deletion README.md
@@ -1,7 +1,7 @@
# DataConveyer_AggregateTokens

DataConveyer_AggregateTokens is a console application to demonstrate how Data Conveyer can be
used to accumulate data extracted from a sequence of input files.
used to accumulate data extracted from a sequence of input files.

There are 10 sample XML files located in ...Data folder. Data Conveyer will process all these
files and identify tokens contained in them (in this example, tokens are just Token nodes). The
Expand Down

0 comments on commit 24e4041

Please sign in to comment.