Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i am trying to read triples of pizza ontology using uri http://www.dcs.bbk.ac.uk/~michael/sw/slides/pizza.owl

code is:

C#
private void button2_Click(object sender, EventArgs e)
       {
           try
           {
               IGraph g = new Graph();


            UriLoader.Load(g, new Uri("http://www.dcs.bbk.ac.uk/~michael/sw/slides/pizza.owl"));
           }
           catch (RdfParseException parseEx)
           {
               //This indicates a parser error e.g unexpected character, premature end of input, invalid syntax etc.
                //parseEx.Message);
               textBox1.Text = parseEx.Message;
           }
           catch (RdfException rdfEx)
           {
               //This represents a RDF error e.g. illegal triple for the given syntax, undefined namespace
               //Console.WriteLine("RDF Error");
               textBox1.Text =  rdfEx.Message;
           }
       }



But when i am running this code i am getting this error



ERROR: [Line 1 Column 6] Spaces are not valid in URIs

i dnt undrstand this. pls help me.
Posted

1 solution

From Uniform Resource Locators (URL)[^]:

Quote:
Other characters are unsafe because
gateways and other transport agents are known to sometimes modify
such characters. These characters are "{", "}", "|", "\", "^", "~",
"[", "]", and "`".

All unsafe characters must always be encoded within a URL.


Try to encode "~" as "%7E":


XML
UriLoader.Load(g, new Uri("http://www.dcs.bbk.ac.uk/%7Emichael/sw/slides/pizza.owl"));
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900