From: Rob V. <rv...@do...> - 2011-07-20 12:45:43
|
Hi Rodrigo I've started adding some basic support into the core library for .Net serialization (ISerializable and IXmlSerializable implementations), the implementations are not complete nor fully tested yet. It is intended to provide serialization for INode implementations, Triples, some IGraph implementations (complex implementations like GraphPersistenceWrapper won't be serializable), SparqlResult and SparqlResultSet. While this is not in a state that I'd recommend for you to test yet does this address your needs in this area? Regards, Rob Vesse ---------------------------------------- From: "Rodrigo de Castro Reis" <rod...@in...> Sent: 05 July 2011 14:03 To: "Rob Vesse" <rv...@do...>, "dotNetRDF Developer Discussion and Feature Request" <dot...@li...> Subject: RES: [dotNetRDF-Develop] RES: SparqlResultSet and SparqlResult Hi Rob, We work a lot with serialization and we had to change dotNetRdf core classes to achieve this (putting Serializable and DataMember attributes).I think a nice and generic solution would be SparqlResultSet and SparqlResult being interfaces and when I create the Query I indicate to use my custom implementation of those interfaces. When I don´t indicate any custom implementation, the current behavior will apply. Regards, Rodrigo Reis | Product Owner - Research Team rod...@in... | www.invit.com.br | @sigainvit Office: +55 34 3223.4000 - 11 2372.1072 | Mobile: +55 34 9661.7499 De: Rob Vesse [mailto:rv...@do...] Enviada em: Tuesday, July 05, 2011 9:53 AM Para: Rodrigo de Castro Reis; 'dotNetRDF Developer Discussion and Feature Request' Cc: Rafael Dias Araújo Assunto: RE: [dotNetRDF-Develop] RES: SparqlResultSet and SparqlResult Hi Rodrigo Ok, so as I see it there are a few options here. Option 1 - Convert to DataTable or some other serializable structure yourself e.g. create your own static method to do the conversion into something you can effectively serialize Option 2 - dotNetRDF should implement .Net serialization on all its core types OR provide wrapper types that can be used where serialization is desired Option 3 - Wait for the next release of the library (currently slated for August) which brings new API enhancements which allow you to control the processing of SPARQL Results as they are produced. This will reduce overhead as you don't have to have intermediate data structures you can just create a class that will process the results directly. This may not be a viable solution for you though if you are tied to using .Net serialization If your preferred option is number 2 I'll add it to the todo list but can't promise it'll be done for the next release as I have plenty of other work to do for that release already Regards, Rob Vesse From: Rodrigo de Castro Reis [mailto:rod...@in...] Sent: 05 July 2011 13:30 To: dotNetRDF Developer Discussion and Feature Request; Rob Vesse Cc: Rafael Dias Araújo Subject: RES: [dotNetRDF-Develop] RES: SparqlResultSet and SparqlResult We tried to serialize the DataTable and we got the exception [1] because the DataTable had no name and after setting the DataTable´s name, we got the exception [2] because LiteralNode is not serializable.Maybe the DataTable column type doesn´t need to be INode, maybe it´s just string. [1]System.InvalidOperationException was unhandled by user code Message=There was an error generating the XML document. Source=System.Xml StackTrace: at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id) at System.Xml.Serialization.XmlSerializer.Serialize(Stream stream, Object o, XmlSerializerNamespaces namespaces) at QueryTest._Default.ExecuteQuery(Object sender, EventArgs e) in C:\Source\Utils\SemanticTestTools\DomainGraphQueryTest\QueryTest\Default.aspx.cs:line 53 at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) InnerException: System.InvalidOperationException Message=Cannot serialize the DataTable. DataTable name is not set. Source=System.Data StackTrace: at System.Data.DataTable.WriteXmlSchema(XmlWriter writer, Boolean writeHierarchy) at System.Data.DataTable.System.Xml.Serialization.IXmlSerializable.WriteXml(XmlWriter writer) at System.Xml.Serialization.XmlSerializationWriter.WriteSerializable(IXmlSerializable serializable, String name, String ns, Boolean isNullable, Boolean wrapped) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterDataTable.Write1_DataTable(Object o) InnerException: [2]System.InvalidOperationException was unhandled by user code Message=There was an error generating the XML document. Source=System.Xml StackTrace: at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id) at System.Xml.Serialization.XmlSerializer.Serialize(Stream stream, Object o, XmlSerializerNamespaces namespaces) at QueryTest._Default.ExecuteQuery(Object sender, EventArgs e) in C:\Source\Utils\SemanticTestTools\DomainGraphQueryTest\QueryTest\Default.aspx.cs:line 53 at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) InnerException: System.InvalidOperationException Message=Type 'VDS.RDF.LiteralNode, dotNetRDF, Version=0.4.1.0, Culture=neutral, PublicKeyToken=331e64d1a8b5942b' does not implement IXmlSerializable interface therefore can not proceed with serialization. Source=System.Data StackTrace: at System.Data.XmlDataTreeWriter.XmlDataRowWriter(DataRow row, String encodedTableName) at System.Data.XmlDataTreeWriter.SaveDiffgramData(XmlWriter xw, Hashtable rowsOrder) at System.Data.NewDiffgramGen.Save(XmlWriter xmlw, DataTable table) at System.Data.DataTable.WriteXml(XmlWriter writer, XmlWriteMode mode, Boolean writeHierarchy) at System.Xml.Serialization.XmlSerializationWriter.WriteSerializable(IXmlSerializable serializable, String name, String ns, Boolean isNullable, Boolean wrapped) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterDataTable.Write1_DataTable(Object o) InnerException: Rodrigo Reis | Product Owner - Research Team rod...@in... | www.invit.com.br | @sigainvit Office: +55 34 3223.4000 - 11 2372.1072 | Mobile: +55 34 9661.7499 De: Rodrigo de Castro Reis [mailto:rod...@in...] Enviada em: Tuesday, July 05, 2011 9:03 AM Para: Rob Vesse; 'dotNetRDF Developer Discussion and Feature Request' Cc: Rafael Dias Araújo Assunto: [dotNetRDF-Develop] RES: SparqlResultSet and SparqlResult Since we have heavy performance requirements, I was trying to do a more directly serialization, with no conversion step. But converting it to DataTable will work. Regards, Rodrigo Reis | Product Owner - Research Team rod...@in... | www.invit.com.br | @sigainvit Office: +55 34 3223.4000 - 11 2372.1072 | Mobile: +55 34 9661.7499 De: Rob Vesse [mailto:rv...@do...] Enviada em: Tuesday, July 05, 2011 5:51 AM Para: 'dotNetRDF Developer Discussion and Feature Request' Cc: Rodrigo de Castro Reis Assunto: RE: [dotNetRDF-Develop] SparqlResultSet and SparqlResult SparqlResult implements IEnumerable so that you can directly enumerate over the columns it represents i.e. the set of key value pairs of variables and values. This is useful since some queries will return result sets where different results contain different columns e.g. queries using UNION Yes SparqlResultSet is effectively a table so you enumerate over the SparqlResult instances which are the rows. If you need to serialize a SparqlResultSet you could cast it to a DataTable and serialize that instead? SparqlResultSet defines an explicit cast to DataTable so that is doable. Regards, Rob Vesse From: Rodrigo de Castro Reis [mailto:rod...@in...] Sent: 04 July 2011 15:18 To: dot...@li... Subject: [dotNetRDF-Develop] SparqlResultSet and SparqlResult Why class SparqlResult implements IEnumerable ? I think SparqlResult is one Row of the SparqlResultSet. I think SparqlResultSet as a Table and SparqlResult as a Row. Am I missing something? We´re providing an endpoint (web-service) for SPARQL queries and these classes are not serializable, that´s why we started questioning this. Regards, Rodrigo Reis | Product Owner - Research Team rod...@in... | www.invit.com.br | @sigainvit Office: +55 34 3223.4000 - 11 2372.1072 | Mobile: +55 34 9661.7499 Confidencialidade: A informação contida nesta mensagem de e-mail, incluindo quaisquer anexos, é confidencial e está reservada apenas à pessoa ou entidade para a qual foi endereçada. Se você não é o destinatário ou a pessoa responsável por encaminhar esta mensagem ao destinatário, você está, por meio desta, notificado que não deverá rever, retransmitir, imprimir, copiar, usar ou distribuir esta mensagem de e-mail ou quaisquer anexos. Caso você tenha recebido esta mensagem por engano, por favor, contate o remetente imediatamente e apague esta mensagem de seu computador ou de qualquer outro banco de dados. Muito obrigado. Confidentiality Notice: The information contained in this email message, including any attachment, is confidential and is intended only for the person or entity to which it is addressed. If you are neither the intended recipient nor the employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that you may not review, retransmit, convert to hard copy, copy, use or distribute this email message or any attachments to it. If you have received this email in error, please contact the sender immediately and delete this message from any computer or other data bank. Thank you. |