From: Giblett, I. <ian...@ea...> - 2015-07-27 13:12:52
|
Hi Rob. Thanks for your quick reply! I tried the URIloader, but it only returns to me an empty graph. Is the URILoader supposed to perform a web request on a URL or is it working exclusively with cached data? If it is doing a request over the web, I don’t see how it could work since I didn’t enter any header information, username or password. (the _webclient in my example takes care of all that. My reason for working with the xml was solely a means of retrieving the information from an HTTP Get before I work on the data. Regarding the BaseUri, I have tried setting the BaseUri property but it makes no difference, I get exactly the same result. Do you have any further suggestions? Kind Regards, Ian From: Rob Vesse [mailto:rv...@do...] Sent: 27 July 2015 12:08 To: dotNetRDF User Help and Support Subject: Re: [dotNetRDF-Support] Help Resolving Name Space issue 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 |