Can you please help me in building the code in setting a Resource to a Class
import com.hp.hpl.jena.ontology.Individual;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.query.Dataset;
import com.hp.hpl.jena.query.ReadWrite;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.tdb.TDBFactory;
public class ModelMain {
String dbName = "DataBase";
String ns1 = "http://text.book/Someone#";
String ns;
Dataset ds;
OntModel m;
// モデルを作成し、データベースに保存 public StoryModel(String Name){
ns = ns1 + Name;
ds = TDBFactory.createDataset(dbName);
m = ModelFactory.createOntologyModel();
}
// リソースをクラスに割り当てる
public void initModel() {
m.createClass(ns + "Thing");
m.createClass(ns + "Object");
saveModel();
}
//モデルの読み書き public void saveModel() {
ds.begin(ReadWrite.WRITE);
m.write(System.out, "RDF/XML-ABBREV");
}
// リソースを作成
public Resource createResource(String resourceName, String clsName) {
String resourceuri = ns + resourceName;
String classuri = ns + className;
Resource classr = m.getResource(classuri);
Individual i = m.createIndividual(resourceuri, classr);
return i;
}
// リソースへのタイプの割り当て
public static boolean setType(Resource resource, String typeName) { //リソースへのタイプの割り当て方法 } }