Amelina
Amelina

Reputation: 172

Empty fields in class when parsing Protege ontology with DotNetRDF

Good day everyone. I write code like in example in tutorial:

Space = new OntologyGraph();
FileLoader.Load(Space, "C:/Users/Serega/Desktop/MAS/SpaceWorld.owl");
OntologyClass Spacemans = Space.CreateOntologyClass(new Uri("C:/Users/Serega/Desktop/MAS/SpaceWorld/Spaceman"));

And finally in "Space" I get all fields assigned nulls, but when I click "Results View" on "Space" in Visual studio I can see right OWL data in right fields. What do I do wrong or not understand?

Then, if I try to get data from "Space":

OntologyClass Spacemans = Space.CreateOntologyClass(Space.CreateUriNode("owl:Spaceman"));

"Spacemans" assigned null and no data in "ResultView".

Upvotes: 0

Views: 186

Answers (1)

RobV
RobV

Reputation: 28675

You are likely not looking up the URIs that are actually in your data but since you haven't shown your data we can only guess at this.

Firstly you are looking for the URI C:/Users/Serega/Desktop/MAS/SpaceWorld/Spaceman in your data which almost certainly does not exist in your data (but you haven't shown it so we can't say for sure)

Secondly you are looking up the prefixed name owl:Spaceman. This will be expanded into a URI by concatenating the namespace for owl which will most likely be http://www.w3.org/2002/07/owl# (but you haven't seen your data so we can't be sure) with Spaceman meaning you are looking for the URI http://www.w3.org/2002/07/owl#Spaceman which again probably isn't in your data.

Try dumping your data to see what URIs are actually in it:

NTriplesFormatter formatter = new NTriplesFormatter();
foreach (Triple t in Space.Triples)
{
  Console.WriteLine(t.ToString(formatter));
}

Upvotes: 0

Related Questions