本文整理汇总了Java中gnu.trove.map.hash.TObjectByteHashMap类的典型用法代码示例。如果您正苦于以下问题:Java TObjectByteHashMap类的具体用法?Java TObjectByteHashMap怎么用?Java TObjectByteHashMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TObjectByteHashMap类属于gnu.trove.map.hash包,在下文中一共展示了TObjectByteHashMap类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clone
import gnu.trove.map.hash.TObjectByteHashMap; //导入依赖的package包/类
@Override
public NodeParameters clone() {
NodeParameters duplicate = new NodeParameters();
if (keyMapping != null) {
duplicate.keyMapping = new HashMap<>(this.keyMapping);
}
if (boolMap != null) {
duplicate.boolMap = new TObjectByteHashMap<>(boolMap);
}
if (longMap != null) {
duplicate.longMap = new TObjectLongHashMap<>(longMap);
}
if (doubleMap != null) {
duplicate.doubleMap = new TObjectDoubleHashMap<>(doubleMap);
}
if (stringMap != null) {
duplicate.stringMap = new HashMap<>(this.stringMap);
}
return duplicate;
}
示例2: runQuery
import gnu.trove.map.hash.TObjectByteHashMap; //导入依赖的package包/类
/**
* Run SPARQL query
* @param uri resource uri
* @param p property
* @return results map: uri-s (if uri is a subject), uri-o (if uri is an object)
*/
private TObjectByteHashMap<String> runQuery(String uri, String p){
TObjectByteHashMap<String> results = new TObjectByteHashMap<String>();
Query query;
String q;
q = "SELECT * WHERE {{?s " + p + " <" + uri + ">. FILTER isIRI(?s). } UNION " +
"{<" + uri + "> " + p + " ?o ." + " FILTER isIRI(?o). }} ";
logger.debug(q);
try {
query = QueryFactory.create(q);
results = executeQuery(query, p);
}
catch (Exception e) {
e.printStackTrace();
}
return results;
}
示例3: set
import gnu.trove.map.hash.TObjectByteHashMap; //导入依赖的package包/类
public NodeParameters set(String key, boolean value) {
ensureKeyType(key, Type.BOOLEAN);
if (boolMap == null) {
boolMap = new TObjectByteHashMap<>();
}
boolMap.put(key, (value ? (byte) 1 : (byte) 0));
return this;
}
示例4: exec
import gnu.trove.map.hash.TObjectByteHashMap; //导入依赖的package包/类
/**
* Execute RDF triple extraction
*/
private void exec(NNode node, String list_props, String uri){
if(node.hasChilds()){
String p;
for (NNode children : node.getChilds()) {
p = children.getValue();
String p_index;
TObjectByteHashMap<String> result = new TObjectByteHashMap<String>();
result.putAll(runQuery(uri, "<" + p + ">"));
if(result.size()>0){
for(String uri_res : result.keySet()){
p_index = String.valueOf(props_index.get(p));
if(inverseProps){
if(result.get(uri_res) == (byte) 1)
p_index = String.valueOf(props_index.get("inv_" + p));
}
if(list_props.length()>0){
itemTree.addBranches(list_props + "-" + p_index, extractKey(uri_res));
exec(children, list_props + "-" + p_index, uri_res);
} else{
itemTree.addBranches(p_index, extractKey(uri_res));
exec(children, p_index, uri_res);
}
}
}
}
}
}
示例5: executeQuery
import gnu.trove.map.hash.TObjectByteHashMap; //导入依赖的package包/类
/**
* Execute SPARQL query
* @param query sparql query
* @param p property
* @return results map: uri-s (if uri is a subject), uri-o (if uri is an object)
*/
private TObjectByteHashMap<String> executeQuery(Query query, String p) {
TObjectByteHashMap<String> results = new TObjectByteHashMap<String>();
QueryExecution qexec = null;
if(model==null){
if(graphURI == null)
qexec = QueryExecutionFactory.sparqlService(endpoint, query); // remote query
else
qexec = QueryExecutionFactory.sparqlService(endpoint, query, graphURI); // remote query
}
else
qexec = QueryExecutionFactory.create(query, model); // local query
try{
//ResultSet res = qexec.execSelect();
ResultSet res = ResultSetFactory.copyResults(qexec.execSelect()) ;
QuerySolution qs;
String n;
while (res.hasNext()) {
qs = res.next();
if (qs.get("o") == null) {
// get subject
n = qs.get("s").toString();
// consider only the type "yago"
if (!p.contains("type"))
results.put(n, (byte) 1); // target as subject
else {
if (n.contains("yago"))
results.put(n, (byte) 1); // target as subject
}
}
else {
// get object
n = qs.get("o").toString();
// consider only the type "yago"
if (!p.contains("type"))
results.put(n, (byte) 0); // target as object
else {
if (n.contains("yago"))
results.put(n, (byte) 0); // target as object
}
}
}
}
catch(Exception e){
e.printStackTrace();
}
finally{
//qexec.close();
}
return results;
}
示例6: AutoDeltaObjectBoolMap
import gnu.trove.map.hash.TObjectByteHashMap; //导入依赖的package包/类
public AutoDeltaObjectBoolMap(Function<ByteBuffer, K> keyCreator) {
this.changes = new ArrayList<>(5);
this.container = new TObjectByteHashMap<>();
this.baselineCommandCount = 0;
this.keyCreator = keyCreator;
}
示例7: AutoDeltaStringBoolMap
import gnu.trove.map.hash.TObjectByteHashMap; //导入依赖的package包/类
public AutoDeltaStringBoolMap() {
this.changes = new ArrayList<>(5);
this.container = new TObjectByteHashMap<>();
this.baselineCommandCount = 0;
}
示例8: AutoDeltaStringByteMap
import gnu.trove.map.hash.TObjectByteHashMap; //导入依赖的package包/类
public AutoDeltaStringByteMap() {
this.changes = new ArrayList<>(5);
this.container = new TObjectByteHashMap<>();
this.baselineCommandCount = 0;
}
示例9: AutoDeltaObjectByteMap
import gnu.trove.map.hash.TObjectByteHashMap; //导入依赖的package包/类
public AutoDeltaObjectByteMap(Function<ByteBuffer, K> keyCreator) {
this.changes = new ArrayList<>(5);
this.container = new TObjectByteHashMap<>();
this.baselineCommandCount = 0;
this.keyCreator = keyCreator;
}