Java - Using Jena APi - Get data from RDF file

前端 未结 1 1109
别那么骄傲
别那么骄傲 2021-01-25 06:42

My question concerns the class Person with the datatype properties hasFirstName, hasLastName, hasDateOfBirth, hasGender

相关标签:
1条回答
  • 2021-01-25 07:39

    Without knowing Jena, I do not see any place in your code where you only select the male entries. Check that while (instances.hasNext()) { loop to see what instances it loops through.

    Because you write for each of that instances a line, the writeLine() method writes both, male and female entries, it might be that

    ExtendedIterator instances = onto.person.listInstances();
    

    returns the two male and female entries you see in your file.

    Also, your example RDF entry has a value of H for gender, but in your code you are using M and Fto check it.

    0 讨论(0)
提交回复
热议问题