热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.stanbol.entityhub.servicesapi.yard.Yard类的使用及代码示例

本文整理了Java中org.apache.stanbol.entityhub.servicesapi.yard.Yard类的一些代码示例,展示了Yard类的具体用法。这些代码示例主要来源于Github

本文整理了Java中org.apache.stanbol.entityhub.servicesapi.yard.Yard类的一些代码示例,展示了Yard类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Yard类的具体详情如下:
包路径:org.apache.stanbol.entityhub.servicesapi.yard.Yard
类名称:Yard

Yard介绍

[英]The Yard represents a local cache for Representations of the Entities and Symbols managed by a referenced site.

Referenced Sites need to provide the configuration if there representations should be cached locally. This is done by using one of the defined CacheStrategy.

The Idea is not to have one big Yard that caches all the representations, but to provide the possibility to use different caches. This means, that each Site can have its own Yard instance. However several Sites might also use the same Yard.

The YardManager is an singleton services that manages the different Yard instances and provides an central point of access for the Entityhuband the SiteManager.

This should also allow for implementing Yards that are based on

  • Indexes generated by dumps of the referred Site
  • local installations of the software used by the referred site
  • and so on ...
    TODO: The framework need to provide a special Yard for storing Symboland EntityMapping information. This Yard is currently referenced as Entityhub-Yard. Do we need also a special API for this Yard? One could still provide a "default" implementation that implements this interface based on a Component that provides the normal Yard service.

Side note: The name yard was chosen as name because in farming "yard" refers to a piece of enclosed land for farm animals or other agricultural purpose and the storage component of the entityhub does the same thing for Entities.
[中]庭院代表一个本地缓存,用于表示被引用站点管理的实体和符号。
如果应该在本地缓存表示,则引用的站点需要提供配置。这是通过使用一种已定义的缓存策略来实现的。
我们的想法不是要有一个大院子来缓存所有的表示,而是提供使用不同缓存的可能性。这意味着,每个站点都可以有自己的庭院实例。然而,几个场地也可能使用同一个场地。
YardManager是一个单例服务,它管理不同的Yard实例,并为EntityHub和SiteManager提供一个中心访问点。
这也应该允许实现基于
*由引用站点的转储生成的索引
*所指站点使用的软件的本地安装
*等等。。。
TODO:框架需要提供一个特殊的场地来存储符号和实体映射信息。该场地目前被称为Entityhub场地。我们还需要一个特殊的API来处理这个院子吗?仍然可以提供一个“默认”实现,该实现基于一个提供正常庭院服务的组件来实现该接口。
旁注:之所以选择“庭院”作为名称,是因为在农业中,“庭院”指的是一块用于农场动物或其他农业用途的封闭土地,entityhub的存储组件对实体也有同样的作用。

代码示例

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.entityhub.core

@Override
public void removeAll() throws YardException {
//ensure that the baseConfig (if present) is not deleted by this
//operation
Representation baseCOnfig= yard.getRepresentation(Cache.BASE_CONFIGURATION_URI);
yard.removeAll();
if(baseConfig != null){
yard.store(baseConfig);
}
}

代码示例来源:origin: apache/stanbol

@Override
protected ValueFactory getValueFactory() {
return yard.getValueFactory();
}
@Override

代码示例来源:origin: apache/stanbol

@Override
public final QueryResultList findEntityReferences(FieldQuery query) throws YardException{
return entityhubYard.findReferences(query);
}
@Override

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.entityhub.core

/**
* Stores the current configuration used for caching documents back to the
* {@link Yard}. This configuration is present in the {@link #additionalMapper}).
* If this field is null than any existing configuration is
* removed form the index.
* @throws YardException on any error while changing the configuration in the
* yard.
* @throws IllegalArgumentException if null is parsed as {@link Yard}.
*/
protected static void storeAdditionalMappingsConfiguration(Yard yard,FieldMapper additionalMapper) throws YardException,IllegalArgumentException {
if(yard == null){
throw new IllegalArgumentException("The parsed Yard MUST NOT be NULL!");
}
if(additiOnalMapper== null){
yard.remove(Cache.ADDITIONAL_CONFIGURATION_URI);
} else {
Representation cOnfig= yard.getValueFactory().createRepresentation(Cache.ADDITIONAL_CONFIGURATION_URI);
writeFieldConfig(config,additionalMapper);
yard.store(config);
}
}
/**

代码示例来源:origin: apache/stanbol

Representation test1 = yard.create(id); // create and add
yard.store(test1);// store
Representation test2 = yard.getValueFactory().createRepresentation(id2); // create
yard.store(test2);// store
assertTrue(yard.isRepresentation(test1.getId())); // test if stored
assertTrue(yard.isRepresentation(test2.getId()));
yard.removeAll(); // remove
assertFalse(yard.isRepresentation(test1.getId())); // test if removed
assertFalse(yard.isRepresentation(test2.getId()));
yard.store(test1);// store
assertTrue(yard.isRepresentation(test1.getId())); // test if stored
yard.removeAll(); // remove
assertFalse(yard.isRepresentation(test1.getId()));

代码示例来源:origin: apache/stanbol

@Test
public void testFindTextWildcards(){
//init the test data
FieldQueryTestData data = getFieldQueryTestData();
//prefix search with *
FieldQuery query = getYard().getQueryFactory().createFieldQuery();
String wildcard = data.textValue1.getText();
wildcard = wildcard.substring(0, wildcard.length()-1) + "*";
query.setConstraint(data.textField, new TextConstraint(wildcard,PatternType.wildcard,false, "en"));
query.addSelectedField(data.refField);
query.addSelectedField(data.textField);
validateQueryResults(query, getYard().find(query),
Arrays.asList(data.r1en.getId(), data.r2en.getId()),
Arrays.asList(data.refField, data.textField));

//wildcard with ?
query = getYard().getQueryFactory().createFieldQuery();
//selects r1en and r2en
wildcard = data.textValue1.getText();
wildcard = wildcard.substring(0, wildcard.length()-1) + "?";
query.setConstraint(data.textField, new TextConstraint(wildcard,PatternType.wildcard,false, "de"));
query.addSelectedField(data.refField);
query.addSelectedField(data.textField);
validateQueryResults(query, getYard().find(query),
Arrays.asList(data.r1de.getId(), data.r2de.getId()),
Arrays.asList(data.refField, data.textField));
}

代码示例来源:origin: apache/stanbol

@Override
protected Representation getRepresentation(String id) throws EntityhubException {
return yard.getRepresentation(id);
}
@Override

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.entityhub.core

@Override
public Iterable store(Iterable representations) throws IllegalArgumentException, YardException {
return yard.store(representations);
}

代码示例来源:origin: apache/stanbol

/**
* Stores the parsed representation to the Yard and also applies the
* configured {@link #getFieldMapper() FieldMappings}.
* @param The representation to store
*/
@Override
public void store(Representation representation) throws ManagedSiteException {
try {
Yard yard = getYard();
fieldMapper.applyMappings(representation, representation, yard.getValueFactory());
yard.store(representation);
} catch (YardException e) {
throw new ManagedSiteException(e.getMessage(), e);
}

}
/**

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.entityhub.core

@Override
public QueryResultList findRepresentation(FieldQuery query) throws YardException, IllegalArgumentException {
return yard.findRepresentation(query);
}

代码示例来源:origin: apache/stanbol

@Override
public String getId() {
return yard.getId();
}

代码示例来源:origin: apache/stanbol

private void deleteEntities(Collection ids) throws YardException {
FieldQuery fieldQuery = getQueryFactory().createFieldQuery();
Collection toDelete = new HashSet(ids);
for(String id : ids){
if(id != null && !id.isEmpty()){
fieldQuery.setConstraint(RdfResourceEnum.aboutRepresentation.getUri(), new ReferenceConstraint(id));
for(Iterator it = entityhubYard.findReferences(fieldQuery).iterator();it.hasNext();){
toDelete.add(it.next());
}
}
}
if(!toDelete.isEmpty()){
entityhubYard.remove(toDelete);
}

}

代码示例来源:origin: apache/stanbol

protected Representation create(String id, boolean store) throws YardException {
Representation r;
if (store) {
r = getYard().create(id);
} else if (id != null && !id.isEmpty()) {
r = getYard().getValueFactory().createRepresentation(id);
} else {
throw new IllegalArgumentException("If store is FALSE the id MUST NOT be NULL nor EMPTY!");
}
representationIds.add(r.getId());
return r;
}

代码示例来源:origin: apache/stanbol

@Override
protected FieldQuery createQuery() {
return yard.getQueryFactory().createFieldQuery();
}
@Override

代码示例来源:origin: apache/stanbol

/**
* Same as {@link #testFindText()} but using
* {@link Yard#findRepresentation(FieldQuery)} to execute the queries
*/
@Test
public void testFindRepresentationText(){
//init the test data
FieldQueryTestData data = getFieldQueryTestData();
//query for all languages and value1
FieldQuery query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.textField, new TextConstraint(data.textValue1.getText()));
validateQueryResults(query, getYard().findRepresentation(query),
Arrays.asList( data.r1.getId(), data.r1en.getId(), data.r1de.getId()),
Arrays.asList(data.textField, data.refField, data.intField));

//same for value2
query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.textField, new TextConstraint(data.textValue2.getText()));
validateQueryResults(query, getYard().findRepresentation(query),
Arrays.asList( data.r2.getId(), data.r2en.getId(), data.r2de.getId()),
Arrays.asList(data.textField, data.refField, data.intField));
}
/**

代码示例来源:origin: apache/stanbol

/**
* Tests if null values within the Iterable are ignored and do not cause an Exception
*
* @throws YardException
*/
@Test
public void testRemoveRepresentationsWithNullValue() throws YardException {
// NOTE: This test needs not to use the create(..) method, because we
// remove the created representation form the store anyway as part of the
// test
String id = "urn:yard.test.testRemoveRepresentationsWithNullValue:representation.id";
Yard yard = getYard();
Representation test = yard.create(id); // create and add
assertTrue(yard.isRepresentation(test.getId()));
yard.remove(Arrays.asList(test.getId(), null));
assertFalse(yard.isRepresentation(test.getId()));
}

代码示例来源:origin: apache/stanbol

/**
* Same as {@link #testFindText()} but using
* {@link Yard#findReferences(FieldQuery)} to execute the queries
*/
@Test
public void testFindReferencesText(){
//init the test data
FieldQueryTestData data = getFieldQueryTestData();
//query for all languages and value1
FieldQuery query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.textField, new TextConstraint(data.textValue1.getText()));
validateQueryResults(query, getYard().findReferences(query),
Arrays.asList(data.r1.getId(), data.r1en.getId(), data.r1de.getId()));

//same for value2
query = getYard().getQueryFactory().createFieldQuery();
query.setConstraint(data.textField, new TextConstraint(data.textValue2.getText()));
validateQueryResults(query, getYard().findReferences(query),
Arrays.asList( data.r2.getId(), data.r2en.getId(), data.r2de.getId()));
}

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.entityhub.core

@Override
public void remove(Iterable ids) throws IllegalArgumentException, YardException {
yard.remove(ids);
}
@Override

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.entityhub.indexing.core

for(Representation r : yard.store(reps)){
QueueItem old = toStore.remove(r.getId());
String.format(errorMsg,entry.getItem().getId(),yard.getId()),
yardException);

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.entityhub.core

@Override
public final QueryResultList find(FieldQuery query) throws YardException{
return entityhubYard.find(query);
}
@Override

推荐阅读
  • SpringBoot uri统一权限管理的实现方法及步骤详解
    本文详细介绍了SpringBoot中实现uri统一权限管理的方法,包括表结构定义、自动统计URI并自动删除脏数据、程序启动加载等步骤。通过该方法可以提高系统的安全性,实现对系统任意接口的权限拦截验证。 ... [详细]
  • 本文介绍了C#中生成随机数的三种方法,并分析了其中存在的问题。首先介绍了使用Random类生成随机数的默认方法,但在高并发情况下可能会出现重复的情况。接着通过循环生成了一系列随机数,进一步突显了这个问题。文章指出,随机数生成在任何编程语言中都是必备的功能,但Random类生成的随机数并不可靠。最后,提出了需要寻找其他可靠的随机数生成方法的建议。 ... [详细]
  • 如何用UE4制作2D游戏文档——计算篇
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了如何用UE4制作2D游戏文档——计算篇相关的知识,希望对你有一定的参考价值。 ... [详细]
  • XML介绍与使用的概述及标签规则
    本文介绍了XML的基本概念和用途,包括XML的可扩展性和标签的自定义特性。同时还详细解释了XML标签的规则,包括标签的尖括号和合法标识符的组成,标签必须成对出现的原则以及特殊标签的使用方法。通过本文的阅读,读者可以对XML的基本知识有一个全面的了解。 ... [详细]
  • CF:3D City Model(小思维)问题解析和代码实现
    本文通过解析CF:3D City Model问题,介绍了问题的背景和要求,并给出了相应的代码实现。该问题涉及到在一个矩形的网格上建造城市的情景,每个网格单元可以作为建筑的基础,建筑由多个立方体叠加而成。文章详细讲解了问题的解决思路,并给出了相应的代码实现供读者参考。 ... [详细]
  • 标题: ... [详细]
  • Go Cobra命令行工具入门教程
    本文介绍了Go语言实现的命令行工具Cobra的基本概念、安装方法和入门实践。Cobra被广泛应用于各种项目中,如Kubernetes、Hugo和Github CLI等。通过使用Cobra,我们可以快速创建命令行工具,适用于写测试脚本和各种服务的Admin CLI。文章还通过一个简单的demo演示了Cobra的使用方法。 ... [详细]
  • 本文介绍了OpenStack的逻辑概念以及其构成简介,包括了软件开源项目、基础设施资源管理平台、三大核心组件等内容。同时还介绍了Horizon(UI模块)等相关信息。 ... [详细]
  • 解决Sharepoint 2013运行状况分析出现的“一个或多个服务器未响应”问题的方法
    本文介绍了解决Sharepoint 2013运行状况分析中出现的“一个或多个服务器未响应”问题的方法。对于有高要求的客户来说,系统检测问题的存在是不可接受的。文章详细描述了解决该问题的步骤,包括删除服务器、处理分布式缓存留下的记录以及使用代码等方法。同时还提供了相关关键词和错误提示信息,以帮助读者更好地理解和解决该问题。 ... [详细]
  • 本文介绍了设计师伊振华受邀参与沈阳市智慧城市运行管理中心项目的整体设计,并以数字赋能和创新驱动高质量发展的理念,建设了集成、智慧、高效的一体化城市综合管理平台,促进了城市的数字化转型。该中心被称为当代城市的智能心脏,为沈阳市的智慧城市建设做出了重要贡献。 ... [详细]
  • 自动轮播,反转播放的ViewPagerAdapter的使用方法和效果展示
    本文介绍了如何使用自动轮播、反转播放的ViewPagerAdapter,并展示了其效果。该ViewPagerAdapter支持无限循环、触摸暂停、切换缩放等功能。同时提供了使用GIF.gif的示例和github地址。通过LoopFragmentPagerAdapter类的getActualCount、getActualItem和getActualPagerTitle方法可以实现自定义的循环效果和标题展示。 ... [详细]
  • 本文介绍了UVALive6575题目Odd and Even Zeroes的解法,使用了数位dp和找规律的方法。阶乘的定义和性质被介绍,并给出了一些例子。其中,部分阶乘的尾零个数为奇数,部分为偶数。 ... [详细]
  • 有没有一种方法可以在不继承UIAlertController的子类或不涉及UIAlertActions的情况下 ... [详细]
  • 使用圣杯布局模式实现网站首页的内容布局
    本文介绍了使用圣杯布局模式实现网站首页的内容布局的方法,包括HTML部分代码和实例。同时还提供了公司新闻、最新产品、关于我们、联系我们等页面的布局示例。商品展示区包括了车里子和农家生态土鸡蛋等产品的价格信息。 ... [详细]
  • 本文整理了Java中java.lang.NoSuchMethodError.getMessage()方法的一些代码示例,展示了NoSuchMethodErr ... [详细]
author-avatar
Li-zHihuAn
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有