Ejemplo n.º 1
0
        public override IGenericGraph AssembleEntityStatements(IInputSource input, IStatementsConfig entityMap, IDictionary <string, string> nsMap)
        {
            cancelled    = false;
            subjectGraph = new VDSGraph();
            subjectGraph.NamespaceMap.Import(NamespaceHelper.ToIGraphNamespaceMap(nsMap));
            foreach (IDictionary <string, string> row in input.GetEntityRecords(entityMap.GetSourceName()))
            {
                if (cancelled)
                {
                    break;
                }

                Uri subjectURI = URIFactory.FromTemplate(entityMap.GetTemplate(), row);
                if (subjectURI == null)
                {
                    break;
                }

                IUriNode subject = subjectGraph.CreateUriNode(subjectURI);
                subjectGraph.Assert(subject, subjectGraph.CreateUriNode("rdf:type"), subjectGraph.CreateUriNode(entityMap.GetClassName()));

                AssemblePredicateObjectsStatements(subject, row, entityMap.GetRelationObjectConfigs());
            }
            return(subjectGraph);
        }