/// <summary>
 /// Initializes a new instance of the <see cref="GenericDataWriterEngine"/> class.
 /// </summary>
 /// <param name="writer">
 /// The writer.
 /// </param>
 /// <param name="schema">
 /// The schema.
 /// </param>
 public RDFDataWriterEngine(XmlWriter writer)
     : base(writer, CreateDataNamespaces())
 {
     this._writer = writer;
     this._writeObservationMethod = this.RDFWriteObservation21;
     this._namespaces             = CreateDataNamespaces();
 }
        protected void RDFWriteMessageTag(string element, RDFNamespaces namespaces)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            // <?xml version="1.0" encoding="UTF-8"?>
            if (!this.Wrapped)
            {
                // <RDFData
                this.WriteStartElement(this.Namespaces.RDF, element);

                // xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                this.WriteNamespaceDecl(this.Namespaces.Xsi);

                // rdf:Property
                this.WriteNamespaceDecl(this.Namespaces.Property);
                this.WriteNamespaceDecl(this.Namespaces.QB);
                this.WriteNamespaceDecl(this.Namespaces.Skos);
                this.WriteNamespaceDecl(this.Namespaces.Xkos);
                this.WriteNamespaceDecl(this.Namespaces.Owl);
                this.WriteNamespaceDecl(this.Namespaces.RDFs);
                this.WriteNamespaceDecl(this.Namespaces.DocTerms);
                this.WriteNamespaceDecl(this.Namespaces.SdmxConcept);

                string schemaLocation    = this.Namespaces.SchemaLocation ?? string.Empty;
                string structureSpecific = string.Empty;

                if (!string.IsNullOrWhiteSpace(schemaLocation))
                {
                    this.WriteAttributeString(this.Namespaces.Xsi, XmlConstants.SchemaLocation, schemaLocation);
                }
            }
        }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GenericDataWriterEngine"/> class.
 /// </summary>
 /// <param name="writer">
 /// The writer.
 /// </param>
 /// <param name="schema">
 /// The schema.
 /// </param>
 public RDFDataWriterEngine(XmlWriter writer)            
     :base(writer,CreateDataNamespaces())
 {
     this._writer = writer;
     this._writeObservationMethod = this.RDFWriteObservation21;
     this._namespaces = CreateDataNamespaces();
 }
        private static RDFNamespaces CreateDataNamespaces()
        {
            var namespaces = new RDFNamespaces();

            namespaces.Xsi            = new NamespacePrefixPair(XmlConstants.XmlSchemaNS, XmlConstants.XmlSchemaPrefix);
            namespaces.RDF            = new NamespacePrefixPair(RDFConstants.RdfNs21, RDFPrefixConstants.RDF);
            namespaces.Property       = new NamespacePrefixPair(RDFConstants.RdfProperty, RDFPrefixConstants.Property);
            namespaces.QB             = new NamespacePrefixPair(RDFConstants.Rdfqb, RDFPrefixConstants.QB);
            namespaces.DocTerms       = new NamespacePrefixPair(RDFConstants.RdfDcTerms, RDFPrefixConstants.DocTerms);
            namespaces.RDFs           = new NamespacePrefixPair(RDFConstants.RdfS, RDFPrefixConstants.RDFs);
            namespaces.Owl            = new NamespacePrefixPair(RDFConstants.RdfOwl, RDFPrefixConstants.Owl);
            namespaces.Skos           = new NamespacePrefixPair(RDFConstants.RdfSkos, RDFPrefixConstants.Skos);
            namespaces.Xkos           = new NamespacePrefixPair(RDFConstants.Rdfxkos, RDFPrefixConstants.Xkos);
            namespaces.XML            = new NamespacePrefixPair(RDFConstants.XmlNs, RDFPrefixConstants.XML);
            namespaces.SdmxConcept    = new NamespacePrefixPair(RDFConstants.RdfSdmxConcept, RDFPrefixConstants.SdmxConcept);
            namespaces.SchemaLocation = string.Format(
                CultureInfo.InvariantCulture, "{0} SDMXMessage.xsd", SdmxConstants.MessageNs21);

            return(namespaces);
        }
        public StructureWriterEngineRDF(XmlWriter writer, RDFNamespaces namespaces, SdmxSchema schema)            
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            if (schema == null)
            {
                throw new ArgumentNullException("schema");
            }
            this._namespaces = namespaces;
            this._writer = writer;
            this._wrapped = writer.WriteState != WriteState.Start;
        }
        public StructureWriterEngineRDF(XmlWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }


            this._namespaces = CreateDataNamespaces();
            this._writer = writer;
            this._wrapped = writer.WriteState != WriteState.Start;
        }
        private static RDFNamespaces CreateDataNamespaces()
        {
            var namespaces = new RDFNamespaces
            {
                Xsi =
                    new NamespacePrefixPair(
                    RDFConstants.XmlSchemaNS, RDFConstants.XmlSchemaPrefix)
            };
                    //Inicializar todos os namespaces que vao ser utilizados
                    namespaces.RDF = new NamespacePrefixPair(RDFConstants.RdfNs21, RDFPrefixConstants.RDF);
                    namespaces.Property = new NamespacePrefixPair(RDFConstants.RdfProperty, RDFPrefixConstants.Property);
                    namespaces.QB = new NamespacePrefixPair(RDFConstants.Rdfqb, RDFPrefixConstants.QB);
                    namespaces.DocTerms = new NamespacePrefixPair(RDFConstants.RdfDcTerms, RDFPrefixConstants.DocTerms);
                    namespaces.RDFs = new NamespacePrefixPair(RDFConstants.RdfS, RDFPrefixConstants.RDFs);
                    namespaces.Owl = new NamespacePrefixPair(RDFConstants.RdfOwl, RDFPrefixConstants.Owl);
                    namespaces.Skos = new NamespacePrefixPair(RDFConstants.RdfSkos, RDFPrefixConstants.Skos);
                    namespaces.Xkos = new NamespacePrefixPair(RDFConstants.Rdfxkos, RDFPrefixConstants.Xkos);
                    namespaces.XML = new NamespacePrefixPair(RDFConstants.XmlNs, RDFPrefixConstants.XML);
                    namespaces.Prov = new NamespacePrefixPair(RDFConstants.RdfProv, RDFPrefixConstants.Prov);
                    namespaces.SdmxConcept = new NamespacePrefixPair(RDFConstants.RdfSdmxConcept, RDFPrefixConstants.SdmxConcept);
                    namespaces.SchemaLocation = string.Format(
                        CultureInfo.InvariantCulture, "{0} SDMXMessage.xsd", SdmxConstants.MessageNs21);      

            return namespaces;
        }
        protected void RDFWriteMessageTag(string element, RDFNamespaces namespaces)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            // <?xml version="1.0" encoding="UTF-8"?>
            if (!this.Wrapped)
            {
                this.RDFWriteStartDocument();
                this.Wrapped = true;

                // <Data
                this.RDFWriteStartElement(this.Namespaces.RDF, element);            
                
                this._dataSetNS = this.Namespaces.RDF;

                this.RDFWriteNamespaceDecl(this._dataSetNS);

                // xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                this.RDFWriteNamespaceDecl(this.Namespaces.Xsi);

                // rdf:Property
                this.RDFWriteNamespaceDecl(this.Namespaces.Property);
                this.RDFWriteNamespaceDecl(this.Namespaces.QB);
                this.RDFWriteNamespaceDecl(this.Namespaces.Skos);
                this.RDFWriteNamespaceDecl(this.Namespaces.Xkos);
                this.RDFWriteNamespaceDecl(this.Namespaces.Owl);
                this.RDFWriteNamespaceDecl(this.Namespaces.RDFs);
                this.RDFWriteNamespaceDecl(this.Namespaces.DocTerms);
                this.RDFWriteNamespaceDecl(this.Namespaces.SdmxConcept);
                this.RDFWriteNamespaceDecl(this.Namespaces.Prov);

                // xsi:schemaLocation="http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message SDMXMessage.xsd">
                string schemaLocation = this.Namespaces.SchemaLocation ?? string.Empty;
                string structureSpecific = string.Empty;
                if (!string.IsNullOrWhiteSpace(structureSpecific))
                {
                    schemaLocation = string.Format(
                        CultureInfo.InvariantCulture, "{0} {1}", schemaLocation, structureSpecific);
                }

                if (!string.IsNullOrWhiteSpace(schemaLocation))
                {
                    this.RDFWriteAttributeString(this.Namespaces.Xsi, RDFConstants.SchemaLocation, schemaLocation);
                }
            }
        }
Пример #9
0
        protected void RDFWriteMessageTag(string element, RDFNamespaces namespaces)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            // <?xml version="1.0" encoding="UTF-8"?>
            if (!this.Wrapped)
            {

                // <RDFData
                this.WriteStartElement(this.Namespaces.RDF, element);

                // xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                this.WriteNamespaceDecl(this.Namespaces.Xsi);

                // rdf:Property
                this.WriteNamespaceDecl(this.Namespaces.Property);
                this.WriteNamespaceDecl(this.Namespaces.QB);
                this.WriteNamespaceDecl(this.Namespaces.Skos);
                this.WriteNamespaceDecl(this.Namespaces.Xkos);
                this.WriteNamespaceDecl(this.Namespaces.Owl);
                this.WriteNamespaceDecl(this.Namespaces.RDFs);
                this.WriteNamespaceDecl(this.Namespaces.DocTerms);
                this.WriteNamespaceDecl(this.Namespaces.SdmxConcept);
                this.WriteNamespaceDecl(this.Namespaces.Prov);
                
                string schemaLocation = this.Namespaces.SchemaLocation ?? string.Empty;
                string structureSpecific = string.Empty;

                if (!string.IsNullOrWhiteSpace(schemaLocation))
                {
                    this.WriteAttributeString(this.Namespaces.Xsi, RDFConstants.SchemaLocation, schemaLocation);
                }


            }
        }