use of nars.NAR in project narchy by automenta.
the class NQuadsRDFTest method testSchema1.
@Disabled
@Test
public void testSchema1() throws Exception {
final NAR n = NARS.tmp();
File output = new File("/tmp/onto.nal");
PrintStream pout = new PrintStream(new BufferedOutputStream(new FileOutputStream(output), 512 * 1024));
n.input(NQuadsRDF.stream(n, new File(// "/tmp/all-layers.nq"
"/home/me/Downloads/nquad")).peek(t -> {
pout.println(t.term().toString() + t.punc());
// t.budget(0, 0.5f);
}));
pout.close();
// n.forEachActiveConcept(c -> {
// c.print();
// });
n.run(1);
// n.focus.active.clear();
n.log();
n.input("$0.9$ (Bacteria <-> Pharmacy)?");
// Param.DEBUG = true;
n.run(128);
// n.index.forEach(c -> {
// System.out.println(c);
// });
}
use of nars.NAR in project narchy by automenta.
the class NQuadsRDFTest method testSchema2.
@Disabled
@Test
public void testSchema2() throws Exception {
final NAR n = NARS.tmp();
Param.DEBUG = true;
for (String input : new String[] { "/home/me/d/finance/money.orig.n3", "/home/me/d/finance/finance.orig.n3" }) {
File output = new File(input + ".nal");
PrintStream pout = new PrintStream(new BufferedOutputStream(new FileOutputStream(output), 512 * 1024));
NQuadsRDF.stream(n, new File(input)).peek(t -> {
t.pri(n.priDefault(t.punc()) / 10f);
pout.println(t + ".");
}).forEach(x -> {
n.input(x);
// allow process
n.run(1);
});
pout.close();
}
// n.forEachActiveConcept(c -> {
// c.print();
// });
// n.run(512);
/*n.concepts().forEach(Concept::print);
n.concept($.the("Buyer")).print();*/
n.clear();
n.log();
n.run(1);
n.input("({I}-->PhysicalPerson).");
n.run(1);
n.input("({I}-->Seller).");
n.run(1);
n.input("({I}-->ExternalRisk).");
n.run(1);
n.input("({I}-->Service).");
n.run(1);
n.input("({I}-->FinancialInstrument).");
n.run(1);
n.input("({I}-->NonResidentCapitalOwner)!");
n.run(1);
n.input("isReceiverOfPhysicalValue(I,#1)!");
n.run(1);
n.input("--isReceiverOfPhysicalValue(#1,I)!");
n.run(1);
n.input("isReceiverOfObligationValue(I,#1)!");
n.run(1);
n.input("--isReceiverOfObligationValue(#1,I)!");
n.run(1);
n.input("$0.99 (I<->?x)?");
n.run(2512);
}
use of nars.NAR in project narchy by automenta.
the class PrologCoreTest method testPrologCoreQuestionTruthAnswer.
@Test
public void testPrologCoreQuestionTruthAnswer() throws Narsese.NarseseException {
NAR n = NARS.tmp();
PrologCore p = new PrologCore(n);
n.input("a:b.");
n.input("a:c.");
n.input("(--, c:d).");
n.run(1);
n.input("a:b?");
// expect true
n.run(1);
n.input("c:d?");
// expect false
n.run(1);
n.input("a:?x?");
// expect true with 2 answers
n.run(1);
}
use of nars.NAR in project narchy by automenta.
the class PrologCoreTest method testConjunction3.
@Test
public void testConjunction3() throws Narsese.NarseseException {
NAR n = NARS.tmp();
PrologCore p = new PrologCore(n);
n.input("(&&,a,b,c).");
n.run(1);
assertTrue(p.isTrue("'&&'(a,b,c)."));
assertTrue(p.isTrue("a,b,c."));
// assertTrue(p.isTrue("','(a,','(b,c))."));
}
use of nars.NAR in project narchy by automenta.
the class PrologCoreTest method testPrologCoreBeliefAssertion.
@Test
public void testPrologCoreBeliefAssertion() throws Narsese.NarseseException {
NAR n = NARS.tmp();
PrologCore p = new PrologCore(n);
n.input("a:b.");
n.input("(--, c:d).");
n.run(1);
assertTrue(p.isTrue("'-->'(b,a)."));
assertFalse(p.isTrue("'-->'(a,b)."));
assertTrue(p.isTrue("'--'('-->'(d,c))."));
assertFalse(p.isTrue("'-->'(d,c)."));
}
Aggregations