ubuntu下用apache限速

2010年3月15日

需要测试低网速下的有些异常,因此我需要对服务器进行限速。有个现成的mod_bw可以使用,但是它的说明不是针对debian的,因此有些地方需要改下。

首先,需要apxs2模块,sudo apt-get install apache2-threaded-dev

接着下载:
wget http://ivn.cl/files/source/mod_bw-0.8.tgz
tar xzvf mod_bw-0.8.tgz

编译并安装:
sudo apxs2 -a -c -i mod_bw.c
大概会出点错误,主要是因为debian里面的apache2配置不太一样的缘故,也没关系,可以继续

创建bw.load:
sudo vi /etc/apache2/mods-available/bw.load
并写入:
LoadModule bw_module /usr/lib/apache2/modules/mod_bw.so

创建bw.conf:
sudo vi /etc/apache2/mods-available/bw.conf
并写入:
<IfModule mod_bw.c>
BandWidthModule On
ForceBandWidthModule On
BandWidth all 51200
MinBandWidth all -1
</IfModule>

最后一步:激活
sudo a2enmod bw(会将bw.load和bw.conf链接到mods-enable文件夹下)

重新启动下 sudo /etc/init.d/apache2 restart

运行期间,需要修改速度,直接修改/etc/apache2/mods-available/bw.conf
然后
sudo /etc/init.d/apache2 reload
即可

enjoy!

服务器

怀揣激动的心情!启程!

2010年3月9日

终于离开值得我一辈子尊敬的公司了!一切自由了!可以自己为自己干活!可以去实现自己的梦想!感谢我的父母!感谢我的女友!感谢我身边的兄弟!感谢我周围的朋友!感谢我之前的同事!2010.3月!人生路程急转弯!记住!

大杂烩

虎年好兆头

2010年2月14日

当吃完年夜饭出来的一霎那,我迎接了第一粒雪花,短短1分钟内,顿时鹅毛大雪。一切都来的如此奇妙,带有悬念,赋予色彩。2010云体科技到底能否诞生,是否可以生存,一切都是那么迷茫,但是个人的信心又是如此充实,这半年内与日俱增,丝毫没有退烧。2002年到现在刚好8年,这8年,我的成长是曲折的、充实的,充满各种冒险色彩、奋斗精神,之前的失败和磨难将成为璀璨明天的积累。2010是我的人生转折点,厚积薄发一触即发,非常感谢自己这8年来仍旧保持一颗激情的心,乐观面对所有的困难,一直矢志不渝在走自己的路。新的人生正式启程,华为杭研,谢谢再见,云体科技,诞生腾飞。

大杂烩

ESWC 2010 Workshop on Ontology Repositories and Editors for the Semantic Web

2010年1月21日

ORES 2010 - Call for papers and system descriptions -
http://www.ontologydynamics.org/od/index.php/ores2010/
Heraklion, Greece - Deadline: March 1, 2010

The growing number of online ontologies makes the availability of ontology repositories, in which ontology practitioners can easily find, select and retrieve reusable components, a crucial issue. The recent emergence of several ontology repository systems is a further sign of this. However, in order for these systems to be successful, it is necessary to provide a forum for researchers and developers to discuss features and exchange ideas on the realization of ontology repositories in general and to consider explicitly their role in the ontology lifecycle. In addition, it is now critical to achieve interoperability between ontology repositories, through common interfaces, standard metadata formats, etc. ORES10 intends to provide such a forum.

Illustrating the importance of the problem, significant initiatives are now emerging. One example is the Open Ontology Repositories (OOR) working group set up by the Ontolog community. Within this effort regular virtual meetings are organized and actively attended by ontology experts from around the world; The Ontolog OOR 2008 meeting was held at the National Institute for Standards in Technology (NIST), generating a joint communiqué outlining requirements and paving the way for collaborations. Another example is the Ontology Metadata Vocabulary (OMV) Consortium, addressing metadata for describing ontologies. Despite these initial efforts, ontology repositories are hardly interoperable amongst themselves. Although sharing similar aims (providing easy access to Semantic Web resources), they diverge in the methods and techniques employed for gathering these documents and making them available; each interprets and uses metadata in a different manner. Furthermore, many features are still poorly supported, such as modularization and versioning, as well as the relationship between ontology repositories and ontology engineering environments (editors) to support the entire ontology ifecycle.

Submitting papers and system descriptions

We want to bring together researchers and practitioners active in the design, development and application of ontology repositories, repository-aware editors, modularization techniques, versioning systems and issues around federated ontology systems. We therefore encourage the submission of research papers, position papers and system descriptions discussing some of the following questions:

* How can ontology repositories “talk” to each other?
* How can the abundant and complex knowledge contained in an ontology repository be made comprehensible for users?
* What is the role of ontology repositories in the ontology lifecycle?
* How can branching and versioning be managed in and across ontology repositories?
* How can ontology repositories interoperate with ontology editors, and other applications and legacy systems?
* How can connections across ontologies be managed within and across ontology repositories?
* How can modularity be better supported in ontology repositories and editors?
* How can ontology repositories and editors use distributed reasoning?
* How can ontology repositories support corporate, national and domain specific semantic infrastructures?
* How do ontology repositories support novel semantic applications?
* What measurements for describing and comparing ontologies can we use? How could ontology repositories use these?

学术会议

用jena api来理解RDFS——subClassOf subPropertyOf range domain

2010年1月9日

这四个词汇与推理密切相关,查看JENA的RDFSRuleReasonerFactory可以看到里面有这么一段代码:

  1. Resource base = capabilities.createResource(getURI());
  2. base.addProperty(ReasonerVocabulary.nameP, "RDFS FB-TGC Rule Reasoner")
  3. .addProperty(ReasonerVocabulary.descriptionP, "Complete RDFS implementation supporting metalevel statements.\nCan separate tbox and abox data if desired to reuse tbox caching or mix them.")
  4. .addProperty(ReasonerVocabulary.supportsP, RDFS.subClassOf)
  5. .addProperty(ReasonerVocabulary.supportsP, RDFS.subPropertyOf)
  6. .addProperty(ReasonerVocabulary.supportsP, RDFS.member)
  7. .addProperty(ReasonerVocabulary.supportsP, RDFS.range)
  8. .addProperty(ReasonerVocabulary.supportsP, RDFS.domain)
  9. .addProperty(ReasonerVocabulary.versionP, "0.1");

说明jena对其提供了支持。

subPropertyOf
如果张三养了一只狗,那么一定可以推理出张三养了一只宠物,因此养狗和有宠物是subPropertyOf关系。

  1. String ns = "htpp://www.crabone.com#";
  2.  
  3. Model model = ModelFactory.createDefaultModel();
  4.  
  5. // 养狗subPropertyOf有宠物
  6. Property hasPet = model.createProperty(ns, "有宠物");
  7. Property hasDog = model.createProperty(ns, "养狗");
  8. model.add(hasDog, RDFS.subPropertyOf, hasPet);
  9.  
  10. // 张三养了一只狗叫汪汪
  11. model.createResource(ns+"张三").addProperty(hasDog, "汪汪");
  12.  
  13. // 得到JENA内置的RDFS推理机
  14. Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
  15.  
  16. // 用原来的图和推理机构造出新的推理图
  17. InfModel infModel = ModelFactory.createInfModel(reasoner, model);
  18.  
  19. System.out.println(infModel.getResource(ns+"张三").getProperty(hasPet));

输出:[htpp://www.crabone.com#张三, htpp://www.crabone.com#有宠物, "汪汪"]
从代码来看,jena的推理是基于图的相关算法来实现的。subClassOf和其道理一样,这里就不啰嗦了。

domain、range

个人感觉这是推理性非常强的一种机制!在protege入门里面就有相关的解释。domain和range是用来描述一个property的,比如:拿养狗这个property来说,一般,只有人才会养狗,水瓶是不会养狗的,电插座也是不会养狗的,所以养狗这个property的domain是(一种class),同样养狗这个property的range是(一种class)。当推理机知道这些道理后,告诉它,张三养了一只汪汪,那么,这个推理机能推理出,张三是人,汪汪是狗。

  1. String ns = "htpp://www.crabone.com#";
  2.  
  3. Model model = ModelFactory.createDefaultModel();
  4.  
  5. // 构造人这个类
  6. Resource personClass = model.createResource(ns+"");
  7. model.add(personClass, RDF.type, RDFS.Class);
  8.  
  9. // 构造狗这个类
  10. Resource dogClass = model.createResource(ns+"");
  11. model.add(dogClass, RDF.type, RDFS.Class);
  12.  
  13. // 构造养狗这个属性,并设置domain是人,range是狗
  14. Property hasDog = model.createProperty(ns, "养狗");
  15. model.add(hasDog, RDFS.domain, personClass);
  16. model.add(hasDog, RDFS.range, dogClass);
  17.  
  18. // 添加张三养了一条狗汪汪这个事实
  19. Resource zhangsan = model.createResource(ns+"张三");
  20. Resource wangwang = model.createResource(ns+"汪汪");
  21. zhangsan.addProperty(hasDog, wangwang);
  22.  
  23. // 构造RDFS推理机
  24. Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
  25.  
  26. // 生成推理图
  27. InfModel infModel = ModelFactory.createInfModel(reasoner, model);
  28.  
  29. System.out.println(infModel.getResource(ns+"张三").getProperty(RDF.type));
  30. System.out.println(infModel.getResource(ns+"汪汪").getProperty(RDF.type));

输出:
[htpp://www.crabone.com#张三, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, htpp://www.crabone.com#人]
[htpp://www.crabone.com#汪汪, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, htpp://www.crabone.com#狗]
总结:domain和rang其实也是一种property;domain这个property用来连接property和class,range这个property用来连接property和class,这是w3的标准,其实在JENA里面比较宽松,domain这个property用来连接property和节点即可,range也是如此。

JENA, 语义网基础