|
From: Rob V. <rv...@do...> - 2015-07-27 11:08:22
|
Ian A default Base URI is only assigned to the target graph under certain circumstances, typically this is when you load the data explicitly through something like FileLoader or UriLoader where it knows something about where the data originates from. The parsers themselves simply use the Base URI of the input graph as the default Base URI assuming the graph comes with one. In your example you do not assign a URI to the graph so there is no default Base URI for the parser to use. Note that you can simplify your code to the following (assuming you don't need the XML elsewhere): Graph tripleGraph = new Graph(); UriLoader.Load(tripleGraph, new Uri(URL)); If you do need to keep the XML around simply assign the Base URI to the graph before you call the parser: tripleGraph.BaseUri = new Uri(URL); Hope this helps, Rob From: "Giblett, Ian" <ian...@ea...> Reply-To: dotNetRDF User Help and Support <dot...@li...> Date: Monday, 27 July 2015 11:27 To: <dot...@li...> Subject: [dotNetRDF-Support] Help Resolving Name Space issue > Hello, > > I’m having trouble parsing some rdf that I’ve received from IBM Doors. > (I’m trying to write an OSLC consumer application.) > > When I try to load my graph and xml into my RdfXmlParser I get an error > message which says “Cannot resolve a Relative Namespace since there is no > in-scope Base URI. Does anyone know what is going on here? > I was under the impression that if no Base URI was present, a default one > would be assigned. > > Since I am getting the xml straight from the tool, is there some parsing > technique I can employ to get around this without having to modify the xml? > (See attached for xml.) > > The code I’m using to parse is: > > String URL; > Graph tripleGraph = new Graph(); > > var ServiceProvder_Response = _webClient.DownloadString(URL); > > XmlDocument ServiceProviderXML = new XmlDocument(); > ServiceProviderXML.LoadXml(ServiceProvder_Response.ToString()); > > RdfXmlParser p = new RdfXmlParser(); > p.Load(GraphOfFolders, ServiceProviderXML); //This line causes > the error > > > > Kind Regards, > > Ian > > > ------------------------------------------------------------------------------ > _______________________________________________ dotNetRDF-Support mailing list > dot...@li... > https://lists.sourceforge.net/lists/listinfo/dotnetrdf-support |