为什么当OntClass创建个人行为不正确?

时间:2018-05-22 15:12:43

标签: java rdf jena owl

问题是: 我希望这段代码具有特殊Individual的rdf:type属性,但是model.write方法给了我这样的输出:

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:j.0="http://microhard.com/graph/"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:j.1="http://microhard.com/property/"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
  <owl:Class rdf:about="http://microhard.com/graph/POI"/>
  <j.0:POI>
    <j.1:p1>111</j.1:p1>
  </j.0:POI>
</rdf:RDF>

这是代码:

public class Main {

    private static final String NS = "http://microhard.com/graph/";

    public static void main(String[] args) {
        OntModel m = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
        OntClass klass = m.createClass(NS + "POI");
        Individual in = klass.createIndividual();
        in.addProperty(m.createProperty("http://microhard.com/property/p1"), "111");
        m.write(System.out, "RDF/XML");

    }
}

1 个答案:

答案 0 :(得分:3)

它是一个类型化的空白节点:

RDF/XML 2.13 Typed Node Elements