Пример #1
0
        public IEnumerable <IDataObject> BindRdfDataObjects(XDocument rdfXmlDocument,
                                                            IList <OrderingDirection> orderingDirections)
        {
            var g = new Graph();

#if PORTABLE || WINDOWS_PHONE
            var parser = new RdfXmlParser(RdfXmlParserMode.Streaming);
            // This is pretty nasty, having to deserialize only to go through parsing again
            parser.Load(g, new System.IO.StringReader(rdfXmlDocument.ToString()));
#else
            var parser = new RdfXmlParser(RdfXmlParserMode.DOM);
            parser.Load(g, rdfXmlDocument.AsXmlDocument());
#endif
            var p              = new VDS.RDF.Query.LeviathanQueryProcessor(new InMemoryDataset(g));
            var queryString    = MakeOrderedResourceQuery(orderingDirections);
            var sparqlParser   = new SparqlQueryParser();
            var query          = sparqlParser.ParseFromString(queryString);
            var queryResultSet = p.ProcessQuery(query) as VDS.RDF.Query.SparqlResultSet;
            foreach (var row in queryResultSet.Results)
            {
                INode uriNode;
                if (row.TryGetBoundValue("x", out uriNode) && uriNode is IUriNode)
                {
                    yield return(BindRdfDataObject(uriNode as IUriNode, g));
                }
            }
        }
        /// <summary>Applies the XML Merge instructions to the configuration files.</summary>
        /// <param name="sourceDoc">The XML document with the merge instructions.</param>
        private void ApplyXmlMerge(XDocument sourceDoc)
        {
            var xmlMerge = new XmlMerge(sourceDoc.AsXmlDocument(), this.ModuleInfo.DesktopModule.Version, this.ModuleInfo.DesktopModule.FriendlyName);

            xmlMerge.UpdateConfigs();
        }
Пример #3
0
        /// <summary>Applies the XML Merge instructions to the configuration files.</summary>
        /// <param name="sourceDoc">The XML document with the merge instructions.</param>
        public void ApplyXmlMerge(XDocument sourceDoc)
        {
            var xmlMerge = new XmlMerge(sourceDoc.AsXmlDocument(), this.Version, this.Sender);

            xmlMerge.UpdateConfigs();
        }