The error message refers to the following part of your code:
g.CreateUriNode("owl:Class")
This uses a prefixed name as a shortcut for the full URI which requires the owl
prefix to be defined in your graph.
If you are getting this then your RDF file does not include this, you can define this like so:
g.NamespaceMap.AddNamespace("prefix", new Uri("http://some/namespace/"));
I guess an OntologyGraph
should really define the OWL namespace automatically, I'll add this in the next release.