Rdf 无法获取输出(OWL)文件中的所有值

Rdf 无法获取输出(OWL)文件中的所有值,rdf,jena,owl,semantic-web,ontology,Rdf,Jena,Owl,Semantic Web,Ontology,我的目标是创建一个本体,并将代码中的所有输入值作为输出输入到owl文件。当我尝试将输出写入.owl文件时,我只得到某些输入值作为输出 这是我的createOn.java .... .... while (propertyiter1.hasNext()) { OntProperty ontProperty1 = propertyiter1.next(); if (ontProperty1.isDatatypeProp

我的目标是创建一个本体,并将代码中的所有输入值作为输出输入到owl文件。当我尝试将输出写入.owl文件时,我只得到某些输入值作为输出

这是我的
createOn.java

....
....
while (propertyiter1.hasNext()) {
                    OntProperty ontProperty1 = propertyiter1.next();

                    if (ontProperty1.isDatatypeProperty()) {
                        String varAttrib = ontProperty1.getLocalName();

                        if (varAttrib.equals("Full_Name"))//here we are checking the ontology name and the given name
                        {
                            String[] arr = cvobj.Fname;
                            System.out.println(arr);
                            for (String m1 : arr) {
                                candidate1.addProperty(ontProperty1, m1);
                                System.out.println(m1);

                            }
                        } else if (varAttrib.equals("Address")) {
                            String[] arr = cvobj.add;
                            for (String m1 : arr) {
                                candidate1.addProperty(ontProperty1, m1);
                                System.out.println(m1);

                            }
                        }else if (varAttrib.equals("Degree")) {
                            String[] arr = cvobj.degree;
                            for (String m1 : arr) {
                                candidate1.addProperty(ontProperty1, m1);
                                System.out.println(m1);

                            }
                        }else if (varAttrib.equals("E_Company")) {
                            String[] arr = cvobj.E_company;
                            for (String m1 : arr) {
                                candidate1.addProperty(ontProperty1, m1);
                                System.out.println(m1);

                            }
                        }else if (varAttrib.equals("Position")) {
                            String[] arr = cvobj.position;
                            for (String m1 : arr) {
                                candidate1.addProperty(ontProperty1, m1);
                                System.out.println(m1);

                            }
                        }else if (varAttrib.equals("Refree_Name")) {
                            String[] arr = cvobj.Rname;
                            for (String m1 : arr) {
                                candidate1.addProperty(ontProperty1, m1);
                                System.out.println(m1);

                            }
                        }else if (varAttrib.equals("R_Company")) {
                            String[] arr = cvobj.rcompany;
                            for (String m1 : arr) {
                                candidate1.addProperty(ontProperty1, m1);
                                System.out.println(m1);

                            }
                        }else if (varAttrib.equals("R_Position")) {
                            String[] arr = cvobj.rposition;
                            for (String m1 : arr) {
                                candidate1.addProperty(ontProperty1, m1);
                                System.out.println(m1);

                            }
                        }else if (varAttrib.equals("R_Email")) {
                            String[] arr = cvobj.RE_address;
                            for (String m1 : arr) {
                                candidate1.addProperty(ontProperty1, m1);
                                System.out.println(m1);

                            }
                        }
                    }
                }
            }
        }
    }

    try {
        m.write(new FileWriter("C:\\Users\\Dharshan\\IdeaProjects\\MatchingCandidates\\src\\main\\java\\ComparisonScreen2\\owl1.owl"), "RDF/XML");

    } catch (IOException e) {
        e.printStackTrace();
    }
public class CVDetails {
   public String[] Fname = {"Janaka"};
   public String[] add = {"malabe"};
   public int T_no = 0777122345;
   public String[] E_address = {"janaka10@gmail.com"};
   public String[] position = {"Manager"};
   public String[] degree = {"IT degree"};
   public String[] E_company = {"ABC Company"};
   public String[] rcompany = {"ABC Company"};
   public String[] rposition = {"Manager"};
   public String[] RE_address = {"jan@gmail.com"};
   public String[] year = {"4 years"};
   public String[] Rname = {"janani"};
   public String[] skills = {"Java", "MSSQL", "MongoDB"};
}
这是我的
CVDetails.java

....
....
while (propertyiter1.hasNext()) {
                    OntProperty ontProperty1 = propertyiter1.next();

                    if (ontProperty1.isDatatypeProperty()) {
                        String varAttrib = ontProperty1.getLocalName();

                        if (varAttrib.equals("Full_Name"))//here we are checking the ontology name and the given name
                        {
                            String[] arr = cvobj.Fname;
                            System.out.println(arr);
                            for (String m1 : arr) {
                                candidate1.addProperty(ontProperty1, m1);
                                System.out.println(m1);

                            }
                        } else if (varAttrib.equals("Address")) {
                            String[] arr = cvobj.add;
                            for (String m1 : arr) {
                                candidate1.addProperty(ontProperty1, m1);
                                System.out.println(m1);

                            }
                        }else if (varAttrib.equals("Degree")) {
                            String[] arr = cvobj.degree;
                            for (String m1 : arr) {
                                candidate1.addProperty(ontProperty1, m1);
                                System.out.println(m1);

                            }
                        }else if (varAttrib.equals("E_Company")) {
                            String[] arr = cvobj.E_company;
                            for (String m1 : arr) {
                                candidate1.addProperty(ontProperty1, m1);
                                System.out.println(m1);

                            }
                        }else if (varAttrib.equals("Position")) {
                            String[] arr = cvobj.position;
                            for (String m1 : arr) {
                                candidate1.addProperty(ontProperty1, m1);
                                System.out.println(m1);

                            }
                        }else if (varAttrib.equals("Refree_Name")) {
                            String[] arr = cvobj.Rname;
                            for (String m1 : arr) {
                                candidate1.addProperty(ontProperty1, m1);
                                System.out.println(m1);

                            }
                        }else if (varAttrib.equals("R_Company")) {
                            String[] arr = cvobj.rcompany;
                            for (String m1 : arr) {
                                candidate1.addProperty(ontProperty1, m1);
                                System.out.println(m1);

                            }
                        }else if (varAttrib.equals("R_Position")) {
                            String[] arr = cvobj.rposition;
                            for (String m1 : arr) {
                                candidate1.addProperty(ontProperty1, m1);
                                System.out.println(m1);

                            }
                        }else if (varAttrib.equals("R_Email")) {
                            String[] arr = cvobj.RE_address;
                            for (String m1 : arr) {
                                candidate1.addProperty(ontProperty1, m1);
                                System.out.println(m1);

                            }
                        }
                    }
                }
            }
        }
    }

    try {
        m.write(new FileWriter("C:\\Users\\Dharshan\\IdeaProjects\\MatchingCandidates\\src\\main\\java\\ComparisonScreen2\\owl1.owl"), "RDF/XML");

    } catch (IOException e) {
        e.printStackTrace();
    }
public class CVDetails {
   public String[] Fname = {"Janaka"};
   public String[] add = {"malabe"};
   public int T_no = 0777122345;
   public String[] E_address = {"janaka10@gmail.com"};
   public String[] position = {"Manager"};
   public String[] degree = {"IT degree"};
   public String[] E_company = {"ABC Company"};
   public String[] rcompany = {"ABC Company"};
   public String[] rposition = {"Manager"};
   public String[] RE_address = {"jan@gmail.com"};
   public String[] year = {"4 years"};
   public String[] Rname = {"janani"};
   public String[] skills = {"Java", "MSSQL", "MongoDB"};
}
我的
owl.owl
文件如下

<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:base="http://www.OBJS.com/CV"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:CV_ontology="http://www.OBJS.com/CV#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
<owl:Ontology rdf:about="http://www.OBJS.com/CV"/>
<owl:Class rdf:about="http://www.OBJS.com/CV#Education">
<rdfs:subClassOf>
  <owl:Class rdf:about="http://www.OBJS.com/CV#CV"/>
</rdfs:subClassOf>
</owl:Class>
<owl:Class rdf:about="http://www.OBJS.com/CV#Experience">
<rdfs:subClassOf rdf:resource="http://www.OBJS.com/CV#CV"/>
</owl:Class>
<owl:Class rdf:about="http://www.OBJS.com/CV#Activities">
<rdfs:subClassOf rdf:resource="http://www.OBJS.com/CV#CV"/>
</owl:Class>
<owl:Class rdf:about="http://www.OBJS.com/CV#Skills">
<rdfs:subClassOf rdf:resource="http://www.OBJS.com/CV#CV"/>
</owl:Class>
<owl:Class rdf:about="http://www.OBJS.com/CV#Referees">
<rdfs:subClassOf rdf:resource="http://www.OBJS.com/CV#CV"/>
</owl:Class>
<owl:Class rdf:about="http://www.OBJS.com/CV#About">
<rdfs:subClassOf rdf:resource="http://www.OBJS.com/CV#CV"/>
</owl:Class>
<owl:Class rdf:about="http://www.OBJS.com/CV#Personal_Details">
<rdfs:subClassOf rdf:resource="http://www.OBJS.com/CV#CV"/>
</owl:Class>
<owl:ObjectProperty rdf:about="http://www.OBJS.com/CV#includes">
<rdfs:label xml:lang="en">includes</rdfs:label>
<rdfs:range rdf:resource="http://www.OBJS.com/CV#Referees"/>
<rdfs:domain rdf:resource="http://www.OBJS.com/CV#CV"/>
<rdfs:range rdf:resource="http://www.OBJS.com/CV#Personal_Details"/>
<rdfs:range rdf:resource="http://www.OBJS.com/CV#About"/>
<rdfs:range rdf:resource="http://www.OBJS.com/CV#Activities"/>
<rdfs:range rdf:resource="http://www.OBJS.com/CV#Experience"/>
<rdfs:range rdf:resource="http://www.OBJS.com/CV#Education"/>
<rdfs:range rdf:resource="http://www.OBJS.com/CV#Skills"/>
</owl:ObjectProperty>
<owl:DatatypeProperty rdf:about="http://www.OBJS.com/CV#R_Position">
<rdfs:label xml:lang="en">R_Position</rdfs:label>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:domain rdf:resource="http://www.OBJS.com/CV#Referees"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://www.OBJS.com/CV#Degree ">
<rdfs:label xml:lang="en">Degree</rdfs:label>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:domain rdf:resource="http://www.OBJS.com/CV#Education"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://www.OBJS.com/CV#Position ">
<rdfs:label xml:lang="en">Position</rdfs:label>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:domain rdf:resource="http://www.OBJS.com/CV#Experience"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://www.OBJS.com/CV#R_TP_No">
<rdfs:label xml:lang="en">R_TP_No</rdfs:label>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:domain rdf:resource="http://www.OBJS.com/CV#Referees"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://www.OBJS.com/CV#Tp_Number ">
<rdfs:label xml:lang="en">Tp_Number</rdfs:label>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#int"/>
<rdfs:domain rdf:resource="http://www.OBJS.com/CV#Personal_Details"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://www.OBJS.com/CV#Full_Name ">
<rdfs:label xml:lang="en">Full_Name</rdfs:label>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:domain rdf:resource="http://www.OBJS.com/CV#Personal_Details"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://www.OBJS.com/CV#Refree_Name">
<rdfs:label xml:lang="en">Refree_Name</rdfs:label>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:domain rdf:resource="http://www.OBJS.com/CV#Referees"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://www.OBJS.com/CV#R_Email">
<rdfs:label xml:lang="en">R_Email</rdfs:label>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:domain rdf:resource="http://www.OBJS.com/CV#Referees"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://www.OBJS.com/CV#R_Company ">
<rdfs:label xml:lang="en">R_Company</rdfs:label>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:domain rdf:resource="http://www.OBJS.com/CV#Referees"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://www.OBJS.com/CV#Activity">
<rdfs:label xml:lang="en">Activity</rdfs:label>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:domain rdf:resource="http://www.OBJS.com/CV#Activities"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://www.OBJS.com/CV#E_Company ">
<rdfs:label xml:lang="en">E_Company</rdfs:label>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:domain rdf:resource="http://www.OBJS.com/CV#Experience"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://www.OBJS.com/CV#Email_Address ">
<rdfs:label xml:lang="en">Email_Address</rdfs:label>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:domain rdf:resource="http://www.OBJS.com/CV#Personal_Details"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://www.OBJS.com/CV#Address ">
<rdfs:label xml:lang="en">Address</rdfs:label>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:domain rdf:resource="http://www.OBJS.com/CV#Personal_Details"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://www.OBJS.com/CV#Official_Address">
<rdfs:label xml:lang="en">Official_Address</rdfs:label>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:domain rdf:resource="http://www.OBJS.com/CV#Referees"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://www.OBJS.com/CV#A_year">
<rdfs:label xml:lang="en">A_year</rdfs:label>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:domain rdf:resource="http://www.OBJS.com/CV#Activities"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://www.OBJS.com/CV#year">
<rdfs:label xml:lang="en">year</rdfs:label>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:domain rdf:resource="http://www.OBJS.com/CV#Experience"/>
</owl:DatatypeProperty>
<CV_ontology:Education rdf:about="http://www.OBJS.com/CV#candidate1">
<CV_ontology:Refree_Name>janani</CV_ontology:Refree_Name>
<rdf:type rdf:resource="http://www.OBJS.com/CV#Personal_Details"/>
<rdf:type rdf:resource="http://www.OBJS.com/CV#Skills"/>
<CV_ontology:R_Position>Manager</CV_ontology:R_Position>
<rdf:type rdf:resource="http://www.OBJS.com/CV#Referees"/>
<rdf:type rdf:resource="http://www.OBJS.com/CV#CV"/>
<rdf:type rdf:resource="http://www.OBJS.com/CV#About"/>
<rdf:type rdf:resource="http://www.OBJS.com/CV#Experience"/>
<rdf:type rdf:resource="http://www.OBJS.com/CV#Activities"/>
<CV_ontology:R_Email>jan@gmail.com</CV_ontology:R_Email>
</CV_ontology:Education>

我无法理解它为什么不将剩余的输出提供给该文件。谁能帮我解决这个问题。提前谢谢

通过删除标记中EOS之后的空格字符解决了该问题

<owl:DatatypeProperty rdf:about="http://www.OBJS.com/CV#Full_Name">