本文整理匯總了Java中com.hp.hpl.jena.rdf.model.ModelFactory.createModelForGraph方法的典型用法代碼示例。如果您正苦於以下問題:Java ModelFactory.createModelForGraph方法的具體用法?Java ModelFactory.createModelForGraph怎麽用?Java ModelFactory.createModelForGraph使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.hp.hpl.jena.rdf.model.ModelFactory
的用法示例。
在下文中一共展示了ModelFactory.createModelForGraph方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: reload
import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
private void reload() {
loader.getMapping().connect();
GraphD2RQ graph = loader.getGraphD2RQ();
datasetGraph = DatasetGraphFactory.createOneGraph(graph);
defaultModel = ModelFactory.createModelForGraph(datasetGraph.getDefaultGraph());
hasTruncatedResults = false;
for (Database db: loader.getMapping().databases()) {
if (db.getResultSizeLimit() != Database.NO_LIMIT) {
hasTruncatedResults = true;
}
}
if (autoReload) {
lastModified = watchedFile.lastModified();
lastReload = System.currentTimeMillis();
}
}
示例2: LimayeGroundtruthAnnotationParser
import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
public LimayeGroundtruthAnnotationParser(Table table) {
this.table = table;
this.cellAnnotation = false;
this.columnAnnotation = false;
this.columnNr = 0;
this.column = -1;
this.row = -1;
this.currentValue = new StringBuilder();
HDT hdt = null;
HDT hdt_l = null;
// HDT hdt_d = null;
try {
hdt = HDTManager.mapIndexedHDT(REDIRECTS, null);
hdt_l = HDTManager.mapIndexedHDT(LABELS, null);
// hdt_d = HDTManager.mapIndexedHDT(TYPES, null);
} catch (IOException e) {
e.printStackTrace();
}
HDTGraph graph = new HDTGraph(hdt);
m = ModelFactory.createModelForGraph(graph);
// graph = new HDTGraph(hdt_d);
// m_d = ModelFactory.createModelForGraph(graph);
graph = new HDTGraph(hdt_l);
m_l = ModelFactory.createModelForGraph(graph);
}
示例3: main
import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
public static void main(String[] args) {
HDT hdt = null;
try {
hdt = HDTManager.mapIndexedHDT(TYPES, null);
} catch (IOException e) {
e.printStackTrace();
}
HDTGraph graph = new HDTGraph(hdt);
Model m = ModelFactory.createModelForGraph(graph);
StmtIterator iter = m.listStatements();
HashMap<String, Integer> hash = new HashMap<String, Integer>();
int number = 0;
while (iter.hasNext()) {
if (number % 50000 == 0) {
System.out.println("Processed Entries: " + number);
}
Statement stmt = iter.next();
RDFNode object = stmt.getObject();
String s = null;
s = object.asResource().getURI();
hash.put(s, 0);
number++;
}
System.out.println("Anzahl an Typen: " +hash.size());
}
示例4: MainEvaluation
import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
public MainEvaluation(String maindir) {
File maind = new File(maindir);
HDT redirectsHDT;
try {
redirectsHDT = HDTManager.mapIndexedHDT("/home/quh/dbpedia_redirects.hdt", null);
final HDTGraph redirectsHDTgraph = new HDTGraph(redirectsHDT);
this.redirects = ModelFactory.createModelForGraph(redirectsHDTgraph);
} catch (IOException e) {
e.printStackTrace();
}
evaluate(maind);
}
示例5: CreateDBPediaIndex
import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
CreateDBPediaIndex() {
super();
this.LABELS = new HashMap<String, HashSet<String>>();
this.UNIQUELABELSTRINGS = new HashMap<String, HashSet<String>>();
this.OCCURRENCES = new HashMap<String, HashMap<String, Integer>>();
this.relationmap = new HashMap<String, LinkedList<String>>();
this.pattymap = new HashMap<String, LinkedList<String>>();
this.pattyfreebasemap = new HashMap<String, LinkedList<String>>();
this.evidencemap = new HashMap<String, HashSet<String>>();
HDT labelhdt;
HDT shortdeschdt;
HDT longdeschdt;
try {
labelhdt = HDTManager.mapIndexedHDT(LABELHDT, null);
shortdeschdt = HDTManager.mapIndexedHDT(SHORTDESCHDT, null);
longdeschdt = HDTManager.mapIndexedHDT(LONGDESCHDT, null);
final HDTGraph labelhdtgraph = new HDTGraph(labelhdt);
final HDTGraph shortdeschdtgraph = new HDTGraph(shortdeschdt);
final HDTGraph longdeschdtgraph = new HDTGraph(longdeschdt);
this.labelmodel = ModelFactory.createModelForGraph(labelhdtgraph);
this.shortdescmodel = ModelFactory
.createModelForGraph(shortdeschdtgraph);
this.longdescmodel = ModelFactory
.createModelForGraph(longdeschdtgraph);
} catch (IOException e) {
e.printStackTrace();
}
this.counter = 0;
}
示例6: Test1
import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
public Test1() {
HDT mappingbasedproperties;
try {
mappingbasedproperties = HDTManager.mapIndexedHDT(
MAPPINGPROPERTIESHDT, null);
final HDTGraph instancemappingtypesgraph = new HDTGraph(
mappingbasedproperties);
this.mappingbasedproperties = ModelFactory
.createModelForGraph(instancemappingtypesgraph);
} catch (IOException e) {
e.printStackTrace();
}
}
示例7: DataRdfizer
import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
public static void DataRdfizer(String arg[]) throws FileNotFoundException, JSONException, IOException {
model = ModelFactory.createModelForGraph(graph) ;
modelReadRDF();
}
示例8: getModelD2RQ
import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
public Model getModelD2RQ() {
if (dataModel == null) {
dataModel = ModelFactory.createModelForGraph(getGraphD2RQ());
}
return dataModel;
}
示例9: init
import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
protected void init() throws IOException
{
JenaAdapter adapter = new JenaAdapter();
context = new QueryContext();
context.init();
adapter.init(context);
Model model = ModelFactory.createModelForGraph(adapter);
dataset = DatasetFactory.create(model);
JenaAdapter rAdapter = new JenaAdapter();
rContext = new QueryReifiedContext();
rContext.init();
rAdapter.init(rContext);
Model rModel = ModelFactory.createModelForGraph(rAdapter);
rDataset = DatasetFactory.create(rModel);
}
示例10: action
import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
public void action() {
HDT hdt = null;
HDT hdt_l = null;
HDT hdt_d = null;
Model m = null;
Model m_l = null;
Model m_d = null;
try {
hdt = HDTManager.mapIndexedHDT(REDIRECTS, null);
hdt_l = HDTManager.mapIndexedHDT(LABELS, null);
// hdt_d = HDTManager.mapIndexedHDT(TYPES, null);
} catch (IOException e) {
e.printStackTrace();
}
HDTGraph graph = new HDTGraph(hdt);
m = ModelFactory.createModelForGraph(graph);
graph = new HDTGraph(hdt_l);
m_l = ModelFactory.createModelForGraph(graph);
File file = new File("/home/quh/Arbeitsfläche/Table Disambiguation Data sets/LimayeAll/all_tables_raw(regen)/");
File[] f = file.listFiles();
int cellsOverall = 0;
int cellsAnnotated = 0;
for (int u = 0; u < f.length; u++) {
// System.out.println(f[u].getAbsolutePath());
StartEvaluationTableEntities eval = new StartEvaluationTableEntities();
String sourcePath = f[u].getAbsolutePath();
Table t = eval.readTable(f[u].getAbsolutePath(), m, m_l, m_d);
if (t != null) {
int cols = t.getNumberofColumns();
for (int i = 0; i < cols; i++) {
Column col = t.getColumn(i);
List<Cell> cellL = col.getCellList();
List<String> types = col.getMajorTypes();
cellsOverall++;
// if(types != null && types.size() > 0) {
// cellsAnnotated++;
// }
for (Cell c : cellL) {
cellsOverall++;
if (c.getGt() != null && !c.getGt().equalsIgnoreCase("")) {
cellsAnnotated++;
}
}
}
System.out.println("Zellen insgesamt: " + cellsOverall + " Zellen annotiert: " + cellsAnnotated);
// Query each column separately
for (int i = 0; i < t.getNumberofColumns(); i++) {
Column column = t.getColumn(i);
List<EntityDisambiguationDPO> request_dpo = eval.transformInRequestFormat(column);
String topic = column.getHeader();
List<Response> l = queryService(request_dpo, topic);
setDisambiguatedColumn(t, i, l);
}
StartEvaluationTableEntities.evaluateResults(t);
}
}
System.out.println("Insgesamt: " + sum + " davon richtig: " + correct);
}
示例11: CreateDBpediaIndexV2
import com.hp.hpl.jena.rdf.model.ModelFactory; //導入方法依賴的package包/類
public CreateDBpediaIndexV2() {
super();
this.relationmap = new HashMap<String, LinkedList<String>>();
this.pattymap = new HashMap<String, LinkedList<String>>();
this.pattyfreebasemap = new HashMap<String, LinkedList<String>>();
this.OCCURRENCES = new HashMap<String, HashMap<String, Integer>>();
this.LABELS = new HashMap<String, HashSet<String>>();
this.UNIQUELABELSTRINGS = new HashMap<String, HashSet<String>>();
this.DBPEDIAGRAPHINLINKS = new HashMap<String, Integer>();
this.evidences = new HashMap<String, String>();
this.teams = new HashSet<String>();
this.urlentitymapping = new HashMap<String, String>();
this.entities = new HashSet<String>();
this.counter = 0;
HDT labelhdt;
HDT shortdeschdt;
HDT longdeschdt;
HDT mappingbasedproperties;
HDT instancemappingtypeshdt;
try {
labelhdt = HDTManager.mapIndexedHDT(LABELHDT, null);
shortdeschdt = HDTManager.mapIndexedHDT(SHORTDESCHDT, null);
longdeschdt = HDTManager.mapIndexedHDT(LONGDESCHDT, null);
mappingbasedproperties = HDTManager.mapIndexedHDT(PERSONDATAHDT, null);
instancemappingtypeshdt = HDTManager.mapIndexedHDT(INSTANCEMAPPINGTYPES, null);
final HDTGraph labelhdtgraph = new HDTGraph(labelhdt);
final HDTGraph shortdeschdtgraph = new HDTGraph(shortdeschdt);
final HDTGraph longdeschdtgraph = new HDTGraph(longdeschdt);
final HDTGraph instancepersondata = new HDTGraph(mappingbasedproperties);
final HDTGraph instancemappingtypesgraph = new HDTGraph(instancemappingtypeshdt);
this.labelmodel = ModelFactory.createModelForGraph(labelhdtgraph);
this.shortdescmodel = ModelFactory.createModelForGraph(shortdeschdtgraph);
this.longdescmodel = ModelFactory.createModelForGraph(longdeschdtgraph);
this.persondata = ModelFactory.createModelForGraph(instancepersondata);
this.instancemappingtypes = ModelFactory.createModelForGraph(instancemappingtypesgraph);
} catch (IOException e) {
e.printStackTrace();
}
}