public virtual void SaveToGraph(VDS.RDF.IGraph target, VDS.RDF.IUriNode provCreatingAction)
        {
            createLocationNode(target);
            //assert that it is a location
            target.Assert(locationNode, UriNodeExt.RdfType(target), target.CreateUriNode(Properties.Settings.Default.Location));
            //assert that it is a tiploc location
            target.Assert(locationNode, UriNodeExt.RdfType(target), target.CreateUriNode(Properties.Settings.Default.TiplocLocation));
            //link to the tiploc code
            ILiteralNode tiplockCodeNode = target.CreateLiteralNode(Tiploc);
            IUriNode     tiplockUriNode  = target.CreateUriNode(Properties.Settings.Default.tiplocCode);

            target.Assert(locationNode, tiplockUriNode, tiplockCodeNode);
            //set the id
            locationNode.IdentifyNode(tiplockCodeNode);
            //lastly, do the prov
            if (provCreatingAction != null)
            {
                locationNode.AssertResponibility(provCreatingAction);
            }
        }
示例#2
0
        public void ProcessHeader(System.IO.StreamReader inStream, ref VDS.RDF.IGraph targetGraph, VDS.RDF.IUriNode generationActivity, string fileName)
        {
            string firstLine = inStream.ReadLine();

            if (!firstLine.StartsWith("HD"))//header record type is HD
            {
                throw new ImportFileFormatException(fileName,
                                                    "File must include a header, denoted HD",
                                                    0,
                                                    0
                                                    );
            }
            string   mainframe_id  = firstLine.Substring(2, 20);
            DateTime date_extract  = DateTime.ParseExact(firstLine.Substring(22, 10), dtFormat, ProgramState.Provider);
            string   curr_file_ref = firstLine.Substring(32, 7);
            string   last_file_ref = firstLine.Substring(39, 7);
            // char update_type = firstLine[46];//not going to use this
            DateTime extract_start = DateTime.ParseExact(firstLine.Substring(48, 6), dateFormat, ProgramState.Provider);
            DateTime extract_end   = DateTime.ParseExact(firstLine.Substring(54, 6), dateFormat, ProgramState.Provider);

            //Now put that in the graph
            string   sourceFileUri  = Common.ImportFileUriBaseString + "#" + DateTime.Now.ToString("o") + "SourceFile_" + fileName;
            IUriNode sourceFileNode = targetGraph.CreateUriNode(UriFactory.Create(sourceFileUri));

            targetGraph.Assert(sourceFileNode, UriNodeExt.RdfType(targetGraph), targetGraph.CreateUriNode("prov:Entity"));
            if (generationActivity != null)
            {
                targetGraph.Assert(generationActivity, targetGraph.CreateUriNode(Properties.Settings.Default.provUsed), sourceFileNode);
            }
            ILiteralNode sourceID = targetGraph.CreateLiteralNode(mainframe_id);

            sourceFileNode.IdentifyNode(sourceID);
            //IUriNode idNode = targetGraph.CreateUriNode(Properties.Settings.Default.ID);
            //targetGraph.Assert(sourceFileNode, idNode, sourceID);
            targetGraph.Assert(sourceFileNode, targetGraph.CreateUriNode(UriFactory.Create(Properties.Settings.Default.provGeneratedTime)),
                               targetGraph.CreateLiteralNode(date_extract.ToString(XmlSpecsHelper.XmlSchemaDateTimeFormat), UriFactory.Create(XmlSpecsHelper.XmlSchemaDataTypeDateTime)));
            IUriNode     invalidatedNote = targetGraph.CreateUriNode(Properties.Settings.Default.provInvalidAtTime);
            ILiteralNode timeInvalid     = targetGraph.CreateLiteralNode(extract_end.ToString(XmlSpecsHelper.XmlSchemaDateTimeFormat), UriFactory.Create(XmlSpecsHelper.XmlSchemaDataTypeDateTime));

            targetGraph.Assert(sourceFileNode, invalidatedNote, timeInvalid);
        }