我已经生成了这个 RDF/XML 数据
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:j.0="http://marco_student/" >
<rdf:Description rdf:nodeID="A0">
<j.0:description>Departamento de Engenharia Civil</j.0:description>
<j.0:abbreviation>DEC</j.0:abbreviation>
<rdf:type rdf:resource="http://marco_student/Department"/>
</rdf:Description>
<rdf:Description rdf:nodeID="A1">
<j.0:description>Departamento de Engenharia Informática</j.0:description>
<j.0:abbreviation>DEI</j.0:abbreviation>
<rdf:type rdf:resource="http://marco_student/Department"/>
</rdf:Description>
<rdf:Description rdf:nodeID="A2">
<j.0:description>Departamento de Engenharia Electrotécnica</j.0:description>
<j.0:abbreviation>DEE</j.0:abbreviation>
<rdf:type rdf:resource="http://marco_student/Department"/>
</rdf:Description>
</rdf:RDF>
使用此代码:
String myNameSpace = "http://william_student/";
Resource departmentClass = ResourceFactory.createResource(myNameSpace+"Department");
Property abbreviationProperty = ResourceFactory.createProperty(myNameSpace, "abbreviation");
Property descriptionProperty = ResourceFactory.createProperty(myNameSpace, "description");
Model departmentModel = ModelFactory.createDefaultModel();
Resource departmentInstance1 = departmentModel.createResource();
departmentInstance1.addProperty(RDF.type, departmentClass);
departmentInstance1.addProperty(abbreviationProperty, "DEI");
我使用这个简单的代码写入文件
File file = new File("D:/departments.rdf");
fos = new FileOutputStream(file);
departmentModel.write(fos);
如您所见,在 RDF 生成的数据中,有j.0
前缀:
我的问题:
如何替换该默认前缀j.0
,但我的前缀喜欢vocabularyMarco