Как связать коды RDF с моей регистрационной формой?
У меня есть Регистрационная форма, после ввода данных она сгенерирует файл RDF. Мой профессор дал мне код генерации RDF, но я не могу понять, как я свяжу его со своей регистрационной страницей.
Что я уже пробовал:
Вот мой код генерации RDF
* To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package ac.at.ju.rdfgraphgeneration; import ac.at.ju.rdfUtility.UploadRDFFile; import ac.at.ju.rdfUtility.DBURIFileDirectoryInformation; import ac.at.ju.rdfUtility.RDFFileWrite; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.LinkedList; import java.util.List; //import javax.management.Query; import org.apache.jena.iri.impl.Main; import org.apache.jena.query.QueryExecution; //import org.apache.jena.query.QueryExecutionFactory; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.RDFList; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.util.FileManager; import org.apache.jena.query.QueryFactory; import org.apache.jena.query.Query; import org.apache.jena.query.QueryExecutionFactory; import org.apache.jena.query.QuerySolution; import org.apache.jena.query.ResultSet; import org.apache.jena.rdf.model.Literal; /** * * @author anindita * * This function will be called when a person creates new account * */ public class RDFAccountInformation { private String fileName; private LinkedList<String> userAccountList; private String dbURI; private String userAccountEntry; public void setDbURI(String dbURI) { this.dbURI = dbURI; } public void setUserAccountEntry(String userAccountEntry) { this.userAccountEntry = userAccountEntry; } public void setFileName(String fileName) { this.fileName = fileName; } public String getFileDirectory() { return DBURIFileDirectoryInformation.getInstance().getFileDirectory(); } public void setUserAccountList(LinkedList<String> userAccountList) { this.userAccountList = userAccountList; } public int getNumberOfUser() { return this.userAccountList.size(); } //RDF file generation public Model getAccountRDF() throws IOException { Model m = ModelFactory.createDefaultModel(); Resource account = m.createResource( this.dbURI + "user" ); Property P = m.createProperty( this.dbURI + "account" ); RDFNode accountNodeArray[]=new RDFNode[getNumberOfUser()]; for(int i=0;i<getNumberOfUser();i++) { accountNodeArray[i]=m.createResource(this.dbURI+this.userAccountList.get(i)); } RDFList list=m.createList(accountNodeArray); m.add(account, P, list); m.setNsPrefix( "db", this.dbURI ); return m; } public void accountInformationGeneration()throws IOException { LinkedList<String> userList=new LinkedList<String> (); if(new File(fileName).exists()) { userList=UploadRDFFile.getInstance(). mainExistUserInformation(this.fileName); } userList.add(this.userAccountEntry); setUserAccountList(userList); RDFFileWrite.getInstance().fileWriteOperation(getAccountRDF(), this.fileName); } //responsible to call all the functions and outside class communicate with this method public void mainAccountInformationGeneration(String userAccountEntry)throws IOException { //this information can be changed { setFileName(getFileDirectory()+"AccountInfo.rdf"); setDbURI(DBURIFileDirectoryInformation.getInstance().getDBURI()); } setUserAccountEntry(userAccountEntry); accountInformationGeneration(); } public static void main(String []p) throws IOException { String accountId="account6"; //input new RDFAccountInformation().mainAccountInformationGeneration(accountId); } }
Richard MacCutchan
Поговори со своим профессором.