[英]Vocabulary creation in Blazegraph
我需要創建一個自定義地理空間數據類型來表示 Blazegraph 中的多邊形,但我不能這樣做,因為它需要為此定義一個詞匯表。 您能否寫信給我有關如何在 Blazegraph 中創建詞匯表的具體步驟?
在同事的幫助下,我設法定義了一個詞匯表,用於在 Blazegraph 中創建自定義地理空間數據類型。 我從此處https://github.com/blazegraph/database克隆了 Blazegraph 代碼,創建了以下 class 並構建(使用 mvn clean install -DskipTests)數據庫和 blazegraph-jar 項目。 最后,使用重命名的 blazegraph-jar...jar 文件作為 blazegraph.jar 並運行此命令:java -server -Xmx4g -Dbigdata.propertyFile=RWStore.properties -jar blazegraph.jar。
package com.bigdata.rdf.vocab;
import com.bigdata.rdf.store.AbstractTripleStore;
import com.bigdata.rdf.vocab.BaseVocabularyDecl;
import com.bigdata.rdf.vocab.Vocabulary;
import com.bigdata.rdf.vocab.core.BigdataCoreVocabulary_v20160317;
import org.openrdf.model.impl.URIImpl;
/**
*
* A {@link Vocabulary} covering the land use code (LUCODE) data.
* Use the vocabulary by adding a property to the configuration file (RWStore.properties) per below.
*
* <code>
*
com.bigdata.rdf.store.AbstractTripleStore.vocabularyClass=
com.bigdata.rdf.vocab.LucodeKGVocabulary
* </code>
*
* @author <a href="mailto:msff2@cam.ac.uk">Feroz Farazi</a>
* @version $Id$
*
*/
public class LucodeKGVocabulary extends BigdataCoreVocabulary_v20160317 {
private String[] uris = {"http://polygon-1-7",
"http://my-lat-lon-starttime-endtime-dt"};
/**
* De-serialization ctor.
*/
public LucodeKGVocabulary() {
super();
}
/**
* Used by {@link AbstractTripleStore#create()}.
*
* @param namespace
* The namespace of the KB instance.
*/
public LucodeKGVocabulary(final String namespace) {
super( namespace );
}
@Override
protected void addValues() {
super.addValues();
for (String uri: uris) {
URIImpl impl = new URIImpl(uri);
BaseVocabularyDecl decl = new BaseVocabularyDecl(impl);
addDecl(decl);
}
}
}
我將以下配置參數放在 RWStore.properties 文件中:
# Sets journal parameters.
com.bigdata.journal.AbstractJournal.file=bigdata.jnl
com.bigdata.journal.AbstractJournal.initialExtent=209715200
com.bigdata.journal.AbstractJournal.maximumExtent=209715200
# Sets the textIndex parameter
com.bigdata.rdf.store.AbstractTripleStore.textIndex=false
com.bigdata.rdf.store.AbstractTripleStore.axiomsClass=
com.bigdata.rdf.axioms.NoAxioms
com.bigdata.rdf.sail.isolatableIndices=false
com.bigdata.rdf.sail.truthMaintenance=false
com.bigdata.rdf.store.AbstractTripleStore.justify=false
# Use our private vocabularies
com.bigdata.rdf.store.AbstractTripleStore.vocabularyClass=
com.bigdata.rdf.vocab.LucodeKGVocabulary
# Assigns the namespace or repository name
com.bigdata.rdf.sail.namespace=testgeospatialdb
com.bigdata.namespace.geospatialdata.spo.com.bigdata.btree.BTree.
branchingFactor=1024
com.bigdata.rdf.store.AbstractTripleStore.quads=false
com.bigdata.namespace.geospatialdata.lex.com.bigdata.btree.BTree.
branchingFactor=400
com.bigdata.rdf.store.AbstractTripleStore.geoSpatial=true
com.bigdata.rdf.store.AbstractTripleStore.statementIdentifiers=false
com.bigdata.rdf.store.AbstractTripleStore.geoSpatialDatatypeConfig.1={
"config": { "uri": "http://polygon-1-7", "fields": [ { "valueType":
"DOUBLE",
"multiplier": "100000", "serviceMapping": "LATITUDE" }, { "valueType":
"DOUBLE", "multiplier": "100000", "serviceMapping": "LONGITUDE" }, {
"valueType": "LONG", "serviceMapping": "starttime" }, { "valueType":
"LONG",
"serviceMapping": "endtime" }{ "valueType": "DOUBLE", "multiplier":
"100000",
"serviceMapping": "LATITUDE" }, { "valueType": "DOUBLE", "multiplier":
"100000", "serviceMapping": "LONGITUDE" }, { "valueType": "LONG",
"serviceMapping": "starttime" }, { "valueType": "LONG", "serviceMapping":
"endtime" }{ "valueType": "DOUBLE", "multiplier": "100000",
"serviceMapping":
"LATITUDE" }, { "valueType": "DOUBLE", "multiplier": "100000",
"serviceMapping": "LONGITUDE" }, { "valueType": "LONG", "serviceMapping":
"starttime" }, { "valueType": "LONG", "serviceMapping": "endtime" }{
"valueType": "DOUBLE", "multiplier": "100000", "serviceMapping":
"LATITUDE"
}, { "valueType": "DOUBLE", "multiplier": "100000", "serviceMapping":
"LONGITUDE" }, { "valueType": "LONG", "serviceMapping": "starttime" }, {
"valueType": "LONG", "serviceMapping": "endtime" }{ "valueType": "DOUBLE",
"multiplier": "100000", "serviceMapping": "LATITUDE" }, { "valueType":
"DOUBLE", "multiplier": "100000", "serviceMapping": "LONGITUDE" }, {
"valueType": "LONG", "serviceMapping": "starttime" }, { "valueType":
"LONG",
"serviceMapping": "endtime" }{ "valueType": "DOUBLE", "multiplier":
"100000",
"serviceMapping": "LATITUDE" }, { "valueType": "DOUBLE", "multiplier":
"100000", "serviceMapping": "LONGITUDE" }, { "valueType": "LONG",
"serviceMapping": "starttime" }, { "valueType": "LONG", "serviceMapping":
"endtime" }{ "valueType": "DOUBLE", "multiplier": "100000",
"serviceMapping":
"LATITUDE" }, { "valueType": "DOUBLE", "multiplier": "100000",
"serviceMapping": "LONGITUDE" }, { "valueType": "LONG", "serviceMapping":
"starttime" }, { "valueType": "LONG", "serviceMapping": "endtime" } ] } }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.