Skip to content

Commit

Permalink
update test script
Browse files Browse the repository at this point in the history
  • Loading branch information
HLWeil committed Apr 26, 2023
1 parent 6357040 commit 3dc5d11
Showing 1 changed file with 52 additions and 25 deletions.
77 changes: 52 additions & 25 deletions test.fsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@

#r "nuget: FSharpAux.Core,2.0.0"
#r "nuget: FsSpreadsheet, 1.3.0-preview"
#r "nuget: FsSpreadsheet.ExcelIO"

//#I @"src\ArcGraphModel\bin\Release\net6.0"
#I @"src\ArcGraphModel.IO\bin\Release\net6.0"
#r "ArcGraphModel.dll"
#r "ArcGraphModel.IO.dll"

#r "nuget: ArcGraphModel, 0.1.0-preview.1"


open FsSpreadsheet
open ArcGraphModel
open ArcGraphModel.IO
Expand All @@ -29,55 +33,78 @@ fsi.AddPrinter (fun (cvp : ICvBase) ->
)

let p = @"C:\Users\HLWei\Downloads\testArc\isa.investigation.xlsx"
let inv = FsWorkbook.fromXlsxFile p
let shortP = @"C:\Users\HLWei\Downloads\testArc\testPersons.xlsx"
let pa = @"C:\Users\HLWei\Downloads\testArc\testAssay.xlsx"


let inv = FsWorkbook.fromXlsxFile pa

let worksheet =
let ws = inv.GetWorksheets().Head
ws.RescanRows()
ws



let tokens =
//worksheet.Tables.[0].Columns(worksheet.CellCollection)
//|> Seq.toList
//|> List.choose (fun r ->
// match r.Cells |> Tokenization.parseLine |> Seq.toList with
// | [] -> None
// | l -> Some l
// )
//|> List.concat
worksheet
|> Worksheet.parseRows
|> Worksheet.parseTableColumns


tokens
|> Seq.head
|> CvAttributeCollection.tryGetAttribute (CvTerm.getName Address.worksheet)
|> Option.get
|> Param.getValue


tokens.[tokens.Length - 1].ToString()



tokens
|> List.choose (CvBase.tryAs<IParam>)
|> List.map (fun param ->
CvBase.getTerm param,
Param.getValue param
)

let containers =
tokens
|> TokenAggregation.aggregateTokens
|> List.filter (fun cv -> CvBase.is<UserParam> cv |> not)

containers
|> Seq.choose CvContainer.tryCvContainer
|> Seq.filter (fun cv -> CvBase.equalsTerm Terms.assay cv )
|> Seq.head
|> CvContainer.getSingleParam "File Name"
|> List.choose (CvContainer.tryCvContainer)
|> List.filter (CvBase.equalsTerm Terms.assay)
|> List.item 0
|> CvContainer.getSingleAs<IParam>("File Name")
|> Param.getValue


//let p2 = @"C:\Users\HLWei\Downloads\testArc\testPersons.xlsx"
//let assay = FsWorkbook.fromXlsxFile p2

//let worksheet2 =
// let ws = assay.GetWorksheets().Head
// ws.RescanRows()
// ws

//let tokens2 =
// worksheet2
// |> List.choose (fun r ->
// match r.Cells |> Tokenization.parseLine |> Seq.toList with
// | [] -> None
// | l -> Some l
// )
// |> List.concat
containers.[2].ToString()

//let containers =
// tokens
// |> TokenAggregation.aggregateTokens

containers
|> Seq.choose CvContainer.tryCvContainer
|> Seq.filter (fun cv -> CvBase.equalsTerm Terms.assay cv )
|> Seq.head
|> CvContainer.getSingleParam "File Name"
|> Param.getValue




//let merge


//let paramLine =
Expand Down Expand Up @@ -162,4 +189,4 @@ containers
// CvParam(Terms.investigation,ParamValue.Value "") :> IParam
// CvParam(Terms.publication,ParamValue.Value "")
// ]
// CvParam(Terms.status,ParamValue.CvValue ("ontobee.com/PO_123","Pending","PO"), attributes)
// CvParam(Terms.status,ParamValue.CvValue ("ontobee.com/PO_123","Pending","PO"), attributes)

0 comments on commit 3dc5d11

Please sign in to comment.