逻辑信息模型(Logical Information Model) for Java:Example 16
"lim4j-samples": Example 16
sample代码如下:
public static void main(String[] args) throws Exception {
Argument a1 = new Argument("This earth which we inhabit, and the other planets, Saturn, Jupiter, Mars, Venus, and Mercury .... "
+ "They all revolve around the sun, ... "
+ "they borrow all their light from the sun, ... "
+ "they are all subject to the same law of gravitation .... "
+ "From all this similitude, it is not unreasonable to think that those planets may, like our earth, be the habitation of various orders of living creatures.");
Statement s1 = new Statement("This earth which we inhabit, and the other planets, Saturn, Jupiter, Mars, Venus, and Mercury");
JudgedStatement js1 = new Proposition("They all revolve around the sun,");
JudgedStatement js2 = new Proposition("they borrow all their light from the sun,");
JudgedStatement js3 = new Proposition("they are all subject to the same law of gravitation");
JudgedStatement js4 = new Proposition("From all this similitude, it is not unreasonable to think that "
+ "those planets may, like our earth, be the habitation of various orders of living creatures.");
JudgedStatement js5 = new JudgedStatementGroup(js1, js2, js3);
a1.addSubInformationElement(s1);
a1.addEvidence(js5);
a1.addConclusion(js4);
Concept c1 = new Concept("the earth");
Concept c2 = new Concept("other planets, Saturn, Jupiter, Mars, Venus, and Mercury");
Concept c3 = new Concept("other planets");
Concept c4 = new Concept("Saturn");
Concept c5 = new Concept("Jupiter");
Concept c6 = new Concept("Mars");
Concept c7 = new Concept("Venus");
Concept c8 = new Concept("Mercury");
Concept c9 = new Concept("revolve around the sun");
Concept c10 = new Concept("borrow all light from the sun");
Concept c11 = new Concept("be subject to the same law of gravitation");
Concept c12 = new Concept("be the habitation of various orders of living creatures");
c2.addSubConcept(c3, c4, c5, c6, c7, c8);
BaseRelation br1 = new MappingRelation(c1, c2);
BaseRelation br2 = new PredicateMappingRelation(c1, c2, c9);
BaseRelation br3 = new PredicateMappingRelation(c1, c2, c10);
BaseRelation br4 = new PredicateMappingRelation(c1, c2, c11);
BaseRelation br5 = new PredicateMappingRelation(c1, c2, c12);
BaseRelation br6 = new RelationGroup(br2, br3, br4, br5);
Root root = new Root(a1, br1, br6);
root.marshalToXml(true, System.out);
}
输出结果:
This earth which we inhabit, and the other planets, Saturn, Jupiter, Mars, Venus, and Mercury .... They all revolve around the sun, ... they borrow all their light from the sun, ... they are all subject to the same law of gravitation .... From all this similitude, it is not unreasonable to think that those planets may, like our earth, be the habitation of various orders of living creatures.
This earth which we inhabit, and the other planets, Saturn, Jupiter, Mars, Venus, and Mercury
They all revolve around the sun,
they borrow all their light from the sun,
they are all subject to the same law of gravitation
From all this similitude, it is not unreasonable to think that those planets may, like our earth, be the habitation of various orders of living creatures.
the earth
other planets, Saturn, Jupiter, Mars, Venus, and Mercury
other planets
Saturn
Jupiter
Mars
Venus
Mercury
revolve around the sun
borrow all light from the sun
be subject to the same law of gravitation
be the habitation of various orders of living creatures
=============================
源代码:
lim4j-samples:https://github.com/CodeJStudio/lim4j-samples
lim4j: https://github.com/CodeJStudio/lim4j
参考文献:
《逻辑信息模型与逻辑信息网络》 / "Theory of Logical Information Model & Logical Information Network"
《从逻辑信息模型,到逻辑信息网络,直至实现通用人工智能》