/// <summary>Maps all triples from default graph to their respective graphs and adds a proper statement to RomanticWeb's meta graph.</summary> /// <param name="tripleStore">The triple store.</param> /// <param name="graphUri">The target graph URI.</param> public static void MapToMetaGraph(this ITripleStore tripleStore, Uri graphUri) { if (tripleStore == null) { throw new ArgumentNullException("tripleStore"); } if (graphUri == null) { throw new ArgumentNullException("graphUri"); } var metaGraphUri = ConfigurationSectionHandler.Default.Factories[DescriptionConfigurationSection.Default.DefaultStoreFactoryName].MetaGraphUri; var metaGraph = tripleStore.FindOrCreate(metaGraphUri); var graph = tripleStore.FindOrCreate(graphUri); var graphNode = metaGraph.CreateUriNode(graphUri); var primaryTopicNode = metaGraph.CreateUriNode(PrimaryTopic); foreach (var triple in graph.Triples) { var subject = (triple.Subject is IUriNode ? (IUriNode)triple.Subject : ((IBlankNode)triple.Subject).FindBlankNodeOwner(tripleStore)); if (subject == null) { continue; } metaGraph.Assert(new Triple(graphNode, primaryTopicNode, subject.CopyNode(metaGraph))); } }