一些常用的JSON命令行处理工具

再复杂一些的,就用EJDB好了(可以认为是SQLite for JSON)

jq

command-line JSON processor.

Totorial http://stedolan.github.io/jq/tutorial/

Manual http://stedolan.github.io/jq/manual/

Install

sudo wget http://stedolan.github.io/jq/download/linux32/jq -O /usr/bin/jq && sudo chmod +x /usr/bin/jq

Or 64-bit (EC2 machines are all 64-bit)

sudo wget http://stedolan.github.io/jq/download/linux64/jq -O /usr/bin/jq && sudo chmod +x /usr/bin/jq

Now on ubuntu 13.10 can use

read more

一个个人知识管理系统

今天看这篇文章:《个人提升方法三部曲:行动,记录、总结

过去这半年来,其实我一直在按这篇文章说的步骤来管理自己的知识。开发这个系统用了我大概一个月的业余时间,随时记录,每天生成总结。现在已经完全离不开它了。

基本技术路线:用semantic wiki做数据录入,用Python API(mwclient)做报表、分析。一点点自动化,每个知识点还是要人产生摘要,然后就可以用各种预先定义好的graph pattern推送到各个页面去。有一点点entity extraction,算是知识提取自动化。语义查询、检索、faceted browsing,可视化,支持知识的进化和重组。这些是知识管理的基本功能。半年多下来,大体每天能积累7-8个新的知识点,现在有上千个了。

read more

语义博客[2008]

【原文写于2008-05-05 到 2008-05-10】

I will try to use this wiki as a blogging tool.

{{BlogInfo
|page=Blog:Baojie
|title=A Blog test
|visitor=Jie Bao
|date=2008/05/05 01:16:38 AM EDT
|tag=Jie’s Words
}}

I get the basic idea on how to implement semantic blogging on the top of semantic wiki.

If an application — may not necessarily be an enterprise application — can be implemented by a relational database, then it can be implemented on a semantic wiki.

(adsbygoogle = window.adsbygoogle || []).push({});

{{BlogInfo
|page=Blog:Baojie
|title=Semantic Blogging
|visitor=User:Baojie
|date=2008/05/09 02:51:24 PM EDT
|tag=Semantic Blog,Jie’s Words
}}

read more

The Return of C 复习C语言

有十年没用C了吧。从Hello World开始复习

习题代码在这里 http://codepad.org/users/baojie

资源:

基本功

链表 Linked List树 Tree11 建树  Create a tree read more

从XSLT调用PHP

call PHP from XSLT [ XSLTProcessor->registerPHPFunctions() ]

<?php
$xml 
= <<<EOB
<all><user>bob</user></all>
EOB;
$xsl = <<<EOB
<?xml version=”1.0″ encoding=”UTF-8″?>
<xsl:stylesheet version=”2.0″
xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”
xmlns:php=”http://php.net/xsl”>
<xsl:output method=”txt” encoding=”utf-8″ indent=”yes”/>
<xsl:template match=”all”>
<xsl:for-each select=”user”>
<xsl:value-of  select=”php:function(‘ucfirst’,string(.))”/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
EOB;
$xmldoc DOMDocument::loadXML($xml);
$xsldoc DOMDocument::loadXML($xsl);

read more

How to explore an ontology using SPARQL 如何浏览一个本体

This article gives some typical SPARQL queries I used for getting familiar with an ontology which is only accessible by a querying endpoint.

1. Classes used

SELECT count(?x) ?type
WHERE{
 ?x a ?type.
}
GROUP BY ?type

2. OWL Classes

Sometime also need to find instances of rdfs:Class

SELECT ?x
WHERE{
 ?x a owl:Class .
}LIMIT 100

Instance counting

SELECT count(?y) ?x
WHERE{
 ?x a owl:Class .
 ?y a ?x .
}
GROUP BY ?x

3. Class Hierarchy

SELECT ?s ?o
WHERE{
 ?s rdfs:subClassOf ?o .
}
LIMIT 100

4. Properties used

read more

一个简单的PHP的RIF Parser

目前支持了RIF-Core

代码很简单,目前乱七八糟的。可以读XML格式的输入,做presentation syntax的输出。正在做LP(logic program)格式的输出(这样就可以用LP的推理机来做推理),还没搞完。

使用的例子:

require_once("../rif2pres.php");
require_once("../rif2lp.php");

// parse XML syntax
$rifdoc = new RifDocument();
$rifdoc->load("ex8.rif");

// write in presentation syntax
$writer = new Rif2Presentation();
$writer->writeAnnotation = true;
$syntax = $writer->toPresentationSyntax($rifdoc);
echo $syntax;

//write in LP syntax
$writer = new Rif2LP();
$writer->toLP($rifdoc);
//print_r($writer->getLP());
echo $writer->getLP()->toString();

如果有兴趣参与,请和我联系(baojie@gmail.com)

read more