I am looking for an overload with above mentioned signature.
I need to load from an XmlDocument because loading from the owl file directly or via a Stream results in an Error:
"The input document has exceeded a limit set by MaxCharactersFromEntities."
Is there something obvious which I am not aware of?
Thanks, Jan
Edit 1 - Adding code showing exception
I try to parse the cell line ontology (~100MB). Because I need only some specific content, I would like to use a handler to focus on the interesting stuff. For demonstartion of my issue, I use the CountHandler
private static void loadCellLineOntology()
{
try
{
var settings = new System.Xml.XmlReaderSettings()
{
MaxCharactersFromEntities = 0,
DtdProcessing = System.Xml.DtdProcessing.Parse
};
var doc = new System.Xml.XmlDocument();
var parser = new VDS.RDF.Parsing.RdfXmlParser(VDS.RDF.Parsing.RdfXmlParserMode.DOM);
//using (var stream = new System.IO.FileStream(@"C:\Users\jan.hummel\Downloads\clo.owl", System.IO.FileMode.Open))
//using (var reader = System.Xml.XmlReader.Create(stream, settings))
using (IGraph g = new NonIndexedGraph())
{
//doc.Load(reader);
//parser.Load(g, @"C:\Users\jahu\Downloads\clo.owl");
var handler = new VDS.RDF.Parsing.Handlers.CountHandler();
parser.Load(handler, @"C:\Users\jahu\Downloads\clo.owl");
//parser.Load(handler, doc);
}
}
catch (Exception ex)
{
Debugger.Break();
}
}
There's nothing obvious. The overload you're looking for doesn't exist, and the RDF/XML parser infrastructure doesn't allow you to set
XmlReaderSettings.MaxCharactersFromEntities.I was able to work around this by replicating the relevant parts of the parser as far down as to change that setting. Beware this is relying on internal implementation details, hence all the private dispatching using
Reflection.The interesting bit is at
CellLineOntology.RdfXmlParser.Context.Generator.ctor(Stream).If you have the code below, you can call
I get a count of 1,387,097 statements using the file you linked.