(FILECREATED " 2-Oct-85 15:06:00" {QV}<NOTECARDS>DATA>NCDATA.LISP;1 31040 ) (* Copyright (c) 1985 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT NCDATACOMS) (RPAQQ NCDATACOMS ((* * Functions for putting data from several notefiles into a text file.) (FNS NCDATA.BuildRawDataFile) (* * General purpose functions for use in collecting data from a notefile.) (FNS NCDATA.CheckForOpenNoteFile NCDATA.GetIdFromTitle NCDATA.GetBoxId) (* * Functions for extracting data about types of items in a notefile.) (FNS NCDATA.GetCardTypesData NCDATA.GetLinkTypesData) (* * Functions for extracting data about a particular card.) (FNS NCDATA.LinksFromCard NCDATA.GetSourcesAndBoxesOfFootnotes NCDATA.GetBoxesOfFootnotes) (* * Functions for extracting data about a particular filebox.) (FNS NCDATA.NumChildrenOfBox NCDATA.ListFiledCardsinBox NCDATA.ListSubBoxesOfBox NCDATA.SubBoxIDsOfBox NCDATA.LinksXperChildren NCDATA.GetLinksXperChild NCDATA.PrintListOfChildrenAndLinks NCDATA.GetAllSubBoxes NCDATA.GetAllSubBoxesNonUnique) (* * Data collection functions.) (FNS TestRun NCDATA.RunNumberOne NCDATA.RunNumberTwo NCDATA.RunNumberThree NCDATA.RunNumberFour NCDATA.RunNumberFive NCDATA.RunNumberSix) (* * Global variables for storing the byproducts or results of certain data analysis functions.) (GLOBALVARS NCDATA.ListOfChildrenAndLinks NCDATA.ListOfLinksFromCard) (* * Stand-alone report generators. Functions for extracting data abvout relations between a set of cards and their fileboxes and sources.) (FNS NCDATA.SourcesInFileboxStructure NCDATA.FileboxesInSourceStructure) (* * Special putpose functions for dealing with data lists.) (FNS NCDATA.ListSeparation NCDATA.GetSourcesOfFootnotes NCDATA.SortFootnotesBySources NCDATA.Source-Links-Lessp NCDATA.GetParentsOfCardInList NCDATA.CompareLinksFromCard))) (* * Functions for putting data from several notefiles into a text file.) (DEFINEQ (NCDATA.BuildRawDataFile [LAMBDA (FileOrStream NoteFiles Functions) (* MLM " 4-Sep-85 08:20") (* * Builds a file of raw data for analysis. The data are extracted from each of the NoteFiles with the Functions.) (LET ((DataFile (if (NOT (OPENP FileOrStream)) then (OPENSTREAM FileOrStream (QUOTE APPEND) (QUOTE OLD/NEW)) else FileOrStream))) (if DataFile then (for file inside NoteFiles do (NCP.OpenNoteFile file T T) (printout DataFile "(* * NoteFile: " file ")" T) (printout DataFile "(") (for function in Functions do (if (EQ (CAR function) (QUOTE !)) then (* "!" is a special flag - function will do its own writing, value will be ignored) (SETQ function (CADR function)) (printout DataFile T "Running " # (PRINT function) " on " (DATE) T) (* run the special fn - convention is for last 2 args to be output stream and "don't close flg") (APPLY (CAR function) (APPEND (CDR function) (LIST DataFile T))) else (printout DataFile T "((* * Output from " # (PRINT function) " on " # (PRINT (DATE) DataFile) ")" T) (PRINT (APPLY (CAR function) (CDR function)) DataFile) (printout DataFile ")" T) (TERPRI DataFile))) (NCP.CloseNoteFile) NIL)) (CLOSEF? DataFile]) ) (* * General purpose functions for use in collecting data from a notefile.) (DEFINEQ (NCDATA.CheckForOpenNoteFile [LAMBDA (FileName) (* rht: " 7-Aug-85 15:55") (* * Return T if either there's an open notefile or we successfully open FileName.) (if (NOT (NCP.CurrentNoteFile)) then (if (INFILEP FileName) then (NCP.OpenNoteFile FileName) else (NCP.PrintMsg NIL T "Can't open file: " FileName))) (NCP.CurrentNoteFile]) (NCDATA.GetIdFromTitle [LAMBDA (BoxIDorTitle) (* MLM " 1-Sep-85 17:00") (if (NCP.ValidCard BoxIDorTitle) then BoxIDorTitle else (CAR (NCP.TitleSearch BoxIDorTitle]) (NCDATA.GetBoxId [LAMBDA (BoxIDorTitle) (* MLM " 1-Sep-85 17:00") (if (NCP.ValidCard BoxIDorTitle) then BoxIDorTitle else (CAR (NCP.TitleSearch BoxIDorTitle]) ) (* * Functions for extracting data about types of items in a notefile.) (DEFINEQ (NCDATA.GetCardTypesData [LAMBDA (FileName) (* MLM " 1-Sep-85 17:23") (* * Return a list of lists. Each sublist is a card type followed by # of cards of that type.) (PROG (TypesSeen) (if (NCDATA.CheckForOpenNoteFile FileName) then (for Card in (NCP.AllCards) bind Type NumSeen do (SETQ Type (NCP.CardType Card)) (PUTPROP Type (QUOTE NumberSeenSoFar) (if (SETQ NumSeen (GETPROP Type (QUOTE NumberSeenSoFar))) then (ADD1 NumSeen) else (SETQ TypesSeen (CONS Type TypesSeen)) 1))) (RETURN (for Type in TypesSeen collect (PROG1 (LIST Type (GETPROP Type (QUOTE NumberSeenSoFar))) (REMPROP Type (QUOTE NumberSeenSoFar] ) (NCDATA.GetLinkTypesData [LAMBDA (FileName) (* rht: " 7-Aug-85 15:59") (* * Return a list of lists. Each sublist is a link type followed by # of cards of that type.) (LET (TypesSeen) (if (NCDATA.CheckForOpenNoteFile FileName) then (for Link in (NCP.AllLinks) bind LinkType NumSeen do (SETQ LinkType (NCP.LinkLabel Link)) (PUTPROP LinkType (QUOTE NumberSeenSoFar) (if (SETQ NumSeen (GETPROP LinkType (QUOTE NumberSeenSoFar))) then (ADD1 NumSeen) else (SETQ TypesSeen (CONS LinkType TypesSeen)) 1))) (for LinkType in TypesSeen collect (PROG1 (LIST LinkType (GETPROP LinkType (QUOTE NumberSeenSoFar))) (REMPROP LinkType (QUOTE NumberSeenSoFar]) ) (* * Functions for extracting data about a particular card.) (DEFINEQ (NCDATA.LinksFromCard [LAMBDA (BoxIDorTitle FileName LinkType BackLinkFlg) (* MLM "10-Sep-85 16:29") (* * Return links of a given LinkType for a given card.) (if (NCDATA.CheckForOpenNoteFile FileName) then (LET ((BoxID (NCDATA.GetIdFromTitle BoxIDorTitle))) (if (NCP.ValidCard BoxID) then [LIST BoxID (NCP.CardTitle BoxID) (SETQ NCDATA.ListOfLinksFromCard (if BackLinkFlg then [for link in (NCP.GetLinks NIL BoxID LinkType) collect (LET ((card (NCP.GetLinkSource link))) (LIST card (NCP.CardTitle card) (NCP.LinkLabel link] else (for link in (NCP.GetLinks BoxID NIL LinkType) collect (LET ((card (NCP.GetLinkDestination link))) (LIST card (NCP.CardTitle card) (NCP.LinkLabel link] else (NCP.PrintMsg NIL T "Arg to NCDATA.LinksFromCard not a valid card: " BoxIDorTitle) (QUOTE ERROR]) (NCDATA.GetSourcesAndBoxesOfFootnotes [LAMBDA (FileName) (* MLM " 2-Sep-85 15:45") (if (NCDATA.CheckForOpenNoteFile FileName) then (LET ((BoxID (NCDATA.GetIdFromTitle "OUTLINE"))) (if (NCP.ValidCard BoxID) then [LIST BoxID (NCP.CardTitle BoxID) (for link in (NCP.GetLinks BoxID NIL NIL) collect (LET ((card (NCP.GetLinkDestination link))) (LIST card (NCP.CardTitle card) (NCP.LinkLabel link) [for link in (NCP.GetLinks card NIL (QUOTE Source)) collect (LET ((source (NCP.GetLinkDestination link))) (LIST source (NCP.CardTitle source) (NCP.LinkLabel link] (for link in (NCP.GetLinks NIL card (QUOTE FiledCard) ) collect (LET ((box (NCP.GetLinkSource link))) (LIST box (NCP.CardTitle box) (NCP.LinkLabel link] else (NCP.PrintMsg NIL T "Call to NCDATA.GetSourcesOfFootnotes -" OUTLINE " not a valid card. ") (QUOTE ERROR]) (NCDATA.GetBoxesOfFootnotes [LAMBDA NIL]) ) (* * Functions for extracting data about a particular filebox.) (DEFINEQ (NCDATA.NumChildrenOfBox [LAMBDA (BoxIDorTitle FileName) (* MLM " 1-Sep-85 17:52") (* * Return number of children of given box.) (if (NCDATA.CheckForOpenNoteFile FileName) then (LET [(BoxID (if (NCP.ValidCard BoxIDorTitle) then BoxIDorTitle else (CAR (NCP.TitleSearch BoxIDorTitle] (if (NCP.FileBoxP BoxID) then (LENGTH (NCP.FileBoxChildren BoxID)) else (NCP.PrintMsg NIL T "Arg to NCDATA.NumChildrenOfBox not filebox or filebox title: " BoxIDorTitle) (QUOTE ERROR]) (NCDATA.ListFiledCardsinBox [LAMBDA (BoxIDorTitle FileName) (* MLM " 1-Sep-85 17:53") (* * Given a FileBox title or ID, collects and lists the ID of each card linked with a FiledCard from link.) (if (NCDATA.CheckForOpenNoteFile FileName) then (LET [(BoxID (if (NCP.ValidCard BoxIDorTitle) then BoxIDorTitle else (CAR (NCP.TitleSearch BoxIDorTitle] (if (NCP.FileBoxP BoxID) then [for Link in (NCP.GetLinks BoxID NIL (QUOTE FiledCard)) collect (LET ((card (NCP.GetLinkDestination Link))) (LIST card (NCP.CardTitle card] else (NCP.PrintMsg NIL T "Arg to NCDATA.NumChildrenOfBox not filebox or filebox title: " BoxIDorTitle) (QUOTE ERROR]) (NCDATA.ListSubBoxesOfBox [LAMBDA (BoxIDorTitle FileName) (* MLM " 1-Sep-85 17:51") (* * Given a FileBox title or ID, collects and lists the ID of each FileBox linked with a SubBox from link.) (if (NCDATA.CheckForOpenNoteFile FileName) then (LET [(BoxID (if (NCP.ValidCard BoxIDorTitle) then BoxIDorTitle else (CAR (NCP.TitleSearch BoxIDorTitle] (if (NCP.FileBoxP BoxID) then [for Link in (NCP.GetLinks BoxID NIL (QUOTE SubBox)) collect (LET ((card (NCP.GetLinkDestination Link))) (LIST card (NCP.CardTitle card] else (NCP.PrintMsg NIL T "Arg to NCDATA.ListSubBoxesOfBox not filebox or filebox title: " BoxIDorTitle) (QUOTE ERROR]) (NCDATA.SubBoxIDsOfBox [LAMBDA (BoxIDorTitle FileName) (* MLM " 2-Sep-85 16:16") (* * Given a FileBox title or ID, collects and lists the ID of each FileBox linked with a SubBox from link.) (if (NCDATA.CheckForOpenNoteFile FileName) then (LET ((BoxID (NCDATA.GetIdFromTitle BoxIDorTitle))) (if (NCP.FileBoxP BoxID) then (for Link in (NCP.GetLinks BoxID NIL (QUOTE SubBox)) collect ( NCP.GetLinkDestination Link)) else (NCP.PrintMsg NIL T "Arg to NCDATA.SubBoxIDsOfBox not filebox or filebox title: " BoxIDorTitle) (QUOTE ERROR]) (NCDATA.LinksXperChildren [LAMBDA (BoxIDorTitle FileName LinkType BackLinkFlg) (* MLM "31-Aug-85 15:14") (* * Returns avg number of sub-links of type X from children of given box. Intended to be used to test the avg number of notes written for each source card in K.A.'s Bibliography filebox. Calls the function NCDATA.GetLinksXperChild and sets the variable NCDATA.ListOfChildrenAndLinks to its output.) (LET NIL (SETQ NCDATA.ListOfChildrenAndLinks (NCDATA.GetLinksXperChild BoxIDorTitle FileName LinkType BackLinkFlg)) (FQUOTIENT [for child in NCDATA.ListOfChildrenAndLinks sum (LENGTH (CAR (LAST child] (LENGTH NCDATA.ListOfChildrenAndLinks]) (NCDATA.GetLinksXperChild [LAMBDA (BoxIDorTitle FileName LinkType BackLinkFlg) (* MLM " 2-Sep-85 15:45") (* * Return links of a given LinkType from the children of a given box.) (if (NCDATA.CheckForOpenNoteFile FileName) then (LET ((BoxID (NCDATA.GetIdFromTitle BoxIDorTitle))) (if (NCP.FileBoxP BoxID) then [for child in (NCP.FileBoxChildren BoxID) collect (LIST child (NCP.CardTitle child) (if BackLinkFlg then [for link in (NCP.GetLinks NIL child LinkType) collect (LET ((card (NCP.GetLinkSource link))) (LIST card (NCP.CardTitle card] else (for link in (NCP.GetLinks child NIL LinkType) collect (LET ((card (NCP.GetLinkDestination link))) (LIST card (NCP.CardTitle card] else (NCP.PrintMsg NIL T "Arg to NCDATA.GetLinksXperChild not filebox or filebox title: " BoxIDorTitle) (QUOTE ERROR]) (NCDATA.PrintListOfChildrenAndLinks [LAMBDA NIL (* MLM " 1-Sep-85 19:36") NCDATA.ListOfChildrenAndLinks]) (NCDATA.GetAllSubBoxes [LAMBDA (FromBox) (* MLM " 2-Sep-85 17:19") (LET ((UnsortedBoxes (NCDATA.GetAllSubBoxesNonUnique FromBox NIL))) (bind UniqueList for Box in UnsortedBoxes do (SETQ UniqueList (MERGEINSERT Box UniqueList T)) finally (RETURN UniqueList]) (NCDATA.GetAllSubBoxesNonUnique [LAMBDA (FromBox BoxesSeen) (* MLM " 2-Sep-85 17:17") (LET* ((ImmedSubBoxes (NCDATA.SubBoxIDsOfBox FromBox)) (BoxesNotSeenBefore (LDIFFERENCE ImmedSubBoxes BoxesSeen)) (NewBoxesSeen (APPEND BoxesNotSeenBefore BoxesSeen))) (if BoxesNotSeenBefore then [for Box in BoxesNotSeenBefore do (SETQ NewBoxesSeen (APPEND NewBoxesSeen ( NCDATA.GetAllSubBoxesNonUnique Box NewBoxesSeen] NewBoxesSeen else NIL]) ) (* * Data collection functions.) (DEFINEQ (TestRun [LAMBDA (NOTEFILE) (* MLM " 2-Oct-85 14:19") (NCDATA.BuildRawDataFile (QUOTE TEST1.DATA) NOTEFILE (QUOTE ((NCDATA.LinksFromCard "OUTLINE"]) (NCDATA.RunNumberOne [LAMBDA NIL (* MLM " 2-Sep-85 20:12") [NCDATA.BuildRawDataFile (QUOTE DATAFILE.TED) (QUOTE ({DSK}<LISPFILES>X500A.NOTEFILE {QV}<NOTECARDS>DATA>X505B-X506A-2I-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X508B-2I-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X510B-2I-NATO-MISSILES.NOTEFILE {DSK}<LISPFILES>X514B-2I-NATO-MISSILES.NOTEFILE)) (QUOTE ((NCDATA.GetCardTypesData) (NCDATA.GetLinkTypesData) (NCDATA.ListSubBoxesOfBox "Index") (NCDATA.NumChildrenOfBox "Bibliography") (NCDATA.ListFiledCardsinBox "Bibliography") (NCDATA.LinksXperChildren "Bibliography" NIL (QUOTE Source) T) (NCDATA.PrintListOfChildrenAndLinks) (NCDATA.LinksFromCard "OUTLINE") (NCDATA.GetSourcesOfFootnotes) (!(NCDATA.FileboxesInSourceStructure)) (!(NCDATA.SourcesInFileboxStructure "Topics"] (LISTFILES DATAFILE.TED]) (NCDATA.RunNumberTwo [LAMBDA NIL (* MLM " 3-Sep-85 12:01") [NCDATA.BuildRawDataFile (QUOTE DATAFILE.TED) (QUOTE ({DSK}<LISPFILES>X510B-2I-NATO-MISSILES.NOTEFILE {DSK}<LISPFILES>X514B-2I-NATO-MISSILES.NOTEFILE)) (QUOTE ((NCDATA.GetCardTypesData) (NCDATA.GetLinkTypesData) (NCDATA.ListSubBoxesOfBox "Index") (NCDATA.NumChildrenOfBox "Bibliography") (NCDATA.ListFiledCardsinBox "Bibliography") (NCDATA.LinksXperChildren "Bibliography" NIL (QUOTE Source) T) (NCDATA.PrintListOfChildrenAndLinks) (NCDATA.LinksFromCard "OUTLINE") (NCDATA.GetSourcesOfFootnotes) (!(NCDATA.FileboxesInSourceStructure)) (!(NCDATA.SourcesInFileboxStructure "Topics"] (LISTFILES DATAFILE.TED]) (NCDATA.RunNumberThree [LAMBDA NIL (* MLM " 4-Sep-85 09:18") [NCDATA.BuildRawDataFile (QUOTE DATAFILE-3) (QUOTE ({DSK}<LISPFILES>X514B-2I-NATO-MISSILES.NOTEFILE)) (QUOTE ((NCDATA.LinksFromCard "OUTLINE") (NCDATA.GetSourcesOfFootnotes) (!(NCDATA.FileboxesInSourceStructure)) (!(NCDATA.SourcesInFileboxStructure "Topics"] (LISTFILES DATAFILE-3]) (NCDATA.RunNumberFour [LAMBDA NIL (* MLM " 7-Sep-85 13:05") [NCDATA.BuildRawDataFile (QUOTE DATAFILE-4) (QUOTE ({QV}<NOTECARDS>DATA>X499B-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>data>X500A-2I-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X500B-X501A-2I-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X501B-2I-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X503A-2I-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X503B-X504A-2I-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X504B-2I-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X504B1-1-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X504B2-1-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X504B3-1-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X505A-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X505B-X506A-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>data>X506B-X507A-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>data>X507B-X508A-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X508B-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X508B1-1-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X508B2-1-NATO-MISSILES.NOTEFILE {QV}<notecards>data>X509A-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>data>X509B-X510A-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X511A-1-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X511B-1-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X513A-1-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X513B-1-NATO-MISSILES.NOTEFILE {QV}<notecards>data>X514A-2I-NATO-MISSILES.NOTEFILE)) (QUOTE ((NCDATA.GetCardTypesData) (NCDATA.NumChildrenOfBox "Bibliography") (NCDATA.GetLinkTypesData) (NCDATA.ListSubBoxesOfBox "CONTENTS") (NCDATA.LinksFromCard "OUTLINE") (NCDATA.GetSourcesOfFootnotes) (!(NCDATA.FileboxesInSourceStructure] (LISTFILES DATAFILE-4]) (NCDATA.RunNumberFive [LAMBDA NIL (* MLM " 7-Sep-85 13:09") [NCDATA.BuildRawDataFile (QUOTE DATAFILE-5) (QUOTE ({QV}<NOTECARDS>DATA>X499B-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>data>X500A-2I-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X500B-X501A-2I-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X501B-2I-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X503A-2I-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X503B-X504A-2I-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X504B-2I-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X504B1-1-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X504B2-1-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X504B3-1-NATO-MISSILES.NOTEFILE {QV}<NOTECARDS>DATA>X505A-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X505B-X506A-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>data>X506B-X507A-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>data>X507B-X508A-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X508B-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X508B1-1-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X508B2-1-NATO-MISSILES.NOTEFILE {QV}<notecards>data>X509A-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>data>X509B-X510A-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X511A-1-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X511B-1-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X513A-1-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X513B-1-NATO-MISSILES.NOTEFILE {QV}<notecards>data>X514A-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>data>X514B-2I-NATO-MISSILES.NOTEFILE)) (QUOTE ((!(NCDATA.SourcesInFileboxStructure "Topics"] (LISTFILES DATAFILE-5]) (NCDATA.RunNumberSix [LAMBDA NIL (* MLM "10-Sep-85 17:57") [NCDATA.BuildRawDataFile (QUOTE DATAFILE-6) (QUOTE ({QV}<notecards>data>X507B-X508A-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X508B-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X508B1-1-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X508B2-1-NATO-MISSILES.NOTEFILE {QV}<notecards>data>X509A-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>data>X509B-X510A-2I-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X510B-1-NATO-MISSILES.NOTEFILE {QV}<notecards>DATA>X513A-1-NATO-MISSILES.NOTEFILE {QV}<notecards>data>X514B-2I-NATO-MISSILES.NOTEFILE)) (QUOTE ((NCDATA.LinksFromCard "OUTLINE"] (LISTFILES DATAFILE-6]) ) (* * Global variables for storing the byproducts or results of certain data analysis functions. ) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS NCDATA.ListOfChildrenAndLinks NCDATA.ListOfLinksFromCard) ) (* * Stand-alone report generators. Functions for extracting data abvout relations between a set of cards and their fileboxes and sources.) (DEFINEQ (NCDATA.SourcesInFileboxStructure [LAMBDA (FileBox OutputFile Don'tClose) (* MLM " 7-Sep-85 12:50") (LET [(SubBoxes (NCDATA.GetAllSubBoxes FileBox)) (OutputStream (OPENSTREAM OutputFile (QUOTE OUTPUT] (bind AllSources AllSubBoxes for Box in SubBoxes do (printout OutputStream "Box " Box " (" (NCP.CardTitle Box) ") : # SubBoxes = " [LENGTH (SETQ AllSubBoxes (NCP.GetLinks Box NIL (QUOTE SubBox] " # FiledCards = " (LENGTH (NCP.GetLinks Box NIL (QUOTE FiledCard))) T) (if AllSubBoxes then (printout OutputFile "SubBoxes:" T)) (for SubBoxLink in AllSubBoxes do (LET ((Destination (NCP.GetLinkDestination SubBoxLink))) (printout OutputFile " Box " Destination "(" (NCP.CardTitle Destination) ")" T))) (SETQ AllSources NIL) [LET* ((CardLinks (NCP.GetLinks Box NIL (QUOTE FiledCard))) (SourceHashTable (HASHARRAY 16))) (for CardLink in CardLinks do (LET [(Sources (for SourceLink in (NCP.GetLinks (NCP.GetLinkDestination CardLink) NIL (QUOTE Source)) collect (NCP.GetLinkDestination SourceLink] (for Source in Sources do (SETQ AllSources (MERGEINSERT Source AllSources T) ) (PUTHASH Source (ADD1 (OR (GETHASH Source SourceHashTable) 0)) SourceHashTable)) (printout OutputStream "Card " (NCP.GetLinkDestination CardLink) "(" (NCP.CardTitle (NCP.GetLinkDestination CardLink)) ")" " sources are: " Sources T))) (for Source in AllSources do (LET ((#Notes (GETHASH Source SourceHashTable))) (printout OutputStream "Source " Source "(" (NCP.CardTitle Source) ")" ": " #Notes " note" (if (IGREATERP #Notes 1) then "s" else "") T] (TERPRI OutputStream)) (if (NOT Don'tClose) then (CLOSEF OutputStream]) (NCDATA.FileboxesInSourceStructure [LAMBDA (OutputFile Don'tClose) (* MLM " 4-Sep-85 08:23") (LET [(AllTheSources (bind Sources for Link in (NCP.GetLinks NIL NIL (QUOTE Source)) do (SETQ Sources (MERGEINSERT (NCP.GetLinkDestination Link) Sources T)) finally (RETURN Sources))) (OutputStream (OR (STREAMP OutputFile) (OPENSTREAM OutputFile (QUOTE OUTPUT] (bind BoxHashTable AllBoxes for Source in AllTheSources do (SETQ BoxHashTable (HASHARRAY 16)) (printout OutputStream "Source: " Source "(" (NCP.CardTitle Source) ")" T) (SETQ AllBoxes NIL) [LET* [(CardLinks (NCP.GetLinks NIL Source (QUOTE Source))) (Cards (for CardLink in CardLinks collect (NCP.GetLinkSource CardLink] (for Card in Cards do (LET [(Boxes (for BoxLink in (NCP.GetLinks NIL Card (QUOTE FiledCard)) collect (LET ((Box (NCP.GetLinkSource BoxLink))) (PUTHASH Box (ADD1 (OR (GETHASH Box BoxHashTable) 0)) BoxHashTable) (SETQ AllBoxes (MERGEINSERT Box AllBoxes T)) Box] (printout OutputStream "Card " Card "(" (NCP.CardTitle Card) ")" " boxes are: " Boxes T))) (for Box in AllBoxes do (LET ((#Notes (GETHASH Box BoxHashTable))) (printout OutputStream "Box " Box "(" (NCP.CardTitle Box) ")" ": " #Notes " note" (if (IGREATERP #Notes 1) then "s" else "") T] (TERPRI OutputStream)) (if (NOT Don'tClose) then (CLOSEF OutputStream]) ) (* * Special putpose functions for dealing with data lists.) (DEFINEQ (NCDATA.ListSeparation [LAMBDA (List Elt1 Elt2) (* rht: " 7-Aug-85 17:06") (* * Return the distance between Elt1 and Elt2 in List assuming both appear in some order.) (for Elt in List as i from 1 bind FirstPos SawElt1FirstFlg do (if (OR (EQ Elt Elt1) (EQ Elt Elt2)) then (if FirstPos then (if (OR (AND SawElt1FirstFlg (EQ Elt Elt2)) (AND (NOT SawElt1FirstFlg) (EQ Elt Elt1))) then (RETURN (DIFFERENCE i FirstPos))) else (if (EQ Elt Elt1) then (SETQ SawElt1FirstFlg T)) (SETQ FirstPos i]) (NCDATA.GetSourcesOfFootnotes [LAMBDA (FileName) (* MLM " 2-Sep-85 15:53") (if (NCDATA.CheckForOpenNoteFile FileName) then (LET ((BoxID (NCDATA.GetBoxId "OUTLINE"))) (if (NCP.ValidCard BoxID) then [LIST BoxID (NCP.CardTitle BoxID) (for link in (NCP.GetLinks BoxID NIL NIL) collect (LET ((card (NCP.GetLinkDestination link))) (LIST card (NCP.CardTitle card) (NCP.LinkLabel link) [for link in (NCP.GetLinks card NIL (QUOTE Source)) collect (LET ((source (NCP.GetLinkDestination link))) (LIST source (NCP.CardTitle source) (NCP.LinkLabel link] (for link in (NCP.GetLinks NIL card (QUOTE FiledCard) ) collect (LET ((box (NCP.GetLinkSource link))) (LIST box (NCP.CardTitle box) (NCP.LinkLabel link] else (NCP.PrintMsg NIL T "Call to NCDATA.GetSourcesOfFootnotes - OUTLINE is not a valid card. ") (QUOTE ERROR]) (NCDATA.SortFootnotesBySources [LAMBDA (ListOfFootnotesWithSources) (* MLM " 4-Sep-85 18:34") (SORT (COPY 514Footnotes) (FUNCTION Source-Links-Lessp]) (NCDATA.Source-Links-Lessp [LAMBDA (X Y) (* MLM " 2-Oct-85 14:27") (ALPHORDER (CAAAR (CDDDR X)) (CAAAR (CDDDR Y]) (NCDATA.GetParentsOfCardInList [LAMBDA (ListOfCardIds&Titles FileName) (* MLM " 1-Oct-85 18:08") (if (NCDATA.CheckForOpenNoteFile FileName) then (for Card in ListOfCardIds&Titles collect (LIST (CAR Card) (if (NCP.ValidCard (CAR Card)) then (LIST "Card's Parents" (NCP.CardParents (CAR Card))) else "Not a valid card"]) (NCDATA.CompareLinksFromCard [LAMBDA (listA listB) (* MLM "10-Sep-85 16:44") (LET* ((A (for card in listA collect (CAR card))) (B (for card in listB collect (CAR card))) (UniqueA (INTERSECTION A A)) (UniqueB (INTERSECTION B B))) (LIST (LIST "UniqueA minus UniqueB" (LDIFFERENCE UniqueA UniqueB)) " " (LIST "UniqueB minus UniqueA" (LDIFFERENCE UniqueB UniqueA]) ) (PUTPROPS NCDATA.LISP COPYRIGHT ("Xerox Corporation" 1985)) (DECLARE: DONTCOPY (FILEMAP (NIL (2036 3949 (NCDATA.BuildRawDataFile 2046 . 3947)) (4032 4994 ( NCDATA.CheckForOpenNoteFile 4042 . 4504) (NCDATA.GetIdFromTitle 4506 . 4751) (NCDATA.GetBoxId 4753 . 4992)) (5073 6920 (NCDATA.GetCardTypesData 5083 . 5996) (NCDATA.GetLinkTypesData 5998 . 6918)) (6988 9316 (NCDATA.LinksFromCard 6998 . 8065) (NCDATA.GetSourcesAndBoxesOfFootnotes 8067 . 9265) ( NCDATA.GetBoxesOfFootnotes 9267 . 9314)) (9387 15395 (NCDATA.NumChildrenOfBox 9397 . 10045) ( NCDATA.ListFiledCardsinBox 10047 . 10903) (NCDATA.ListSubBoxesOfBox 10905 . 11756) ( NCDATA.SubBoxIDsOfBox 11758 . 12450) (NCDATA.LinksXperChildren 12452 . 13218) ( NCDATA.GetLinksXperChild 13220 . 14297) (NCDATA.PrintListOfChildrenAndLinks 14299 . 14465) ( NCDATA.GetAllSubBoxes 14467 . 14823) (NCDATA.GetAllSubBoxesNonUnique 14825 . 15393)) (15435 23047 ( TestRun 15445 . 15679) (NCDATA.RunNumberOne 15681 . 16787) (NCDATA.RunNumberTwo 16789 . 17720) ( NCDATA.RunNumberThree 17722 . 18212) (NCDATA.RunNumberFour 18214 . 20305) (NCDATA.RunNumberFive 20307 . 22191) (NCDATA.RunNumberSix 22193 . 23045)) (23406 27562 (NCDATA.SourcesInFileboxStructure 23416 . 25746) (NCDATA.FileboxesInSourceStructure 25748 . 27560)) (27630 30958 (NCDATA.ListSeparation 27640 . 28374) (NCDATA.GetSourcesOfFootnotes 28376 . 29558) (NCDATA.SortFootnotesBySources 29560 . 29761) ( NCDATA.Source-Links-Lessp 29763 . 29963) (NCDATA.GetParentsOfCardInList 29965 . 30444) ( NCDATA.CompareLinksFromCard 30446 . 30956))))) STOP