use of org.w3._2005.atom in project hale by halestudio.
the class ModelRifToRifTranslator method createTargetInstanceMembershipFormula.
private Assert createTargetInstanceMembershipFormula(Actions actions, ModelSentence sentence, RifVariable instanceVariable) {
Assert assert1 = factory.createAssert();
Target target = factory.createAssertTarget();
Member member = factory.createMember();
Instance instance = factory.createInstance();
Var var = factory.createVar();
var.getContent().add(instanceVariable.getName());
instance.setVar(var);
member.setInstance(instance);
org.w3._2007.rif.Class clazz = factory.createClass();
Const const1 = factory.createConst();
// $NON-NLS-1$
const1.setType("rif:iri");
const1.getContent().add(instanceVariable.getClassName());
clazz.setConst(const1);
member.setClazz(clazz);
target.setMember(member);
assert1.setTarget(target);
return assert1;
}
use of org.w3._2005.atom in project hale by halestudio.
the class ModelRifToRifTranslator method initialiseFrame.
private Frame initialiseFrame(RifVariable contextVariable) {
Frame frame = factory.createFrame();
frame = factory.createFrame();
org.w3._2007.rif.Object frameObject = factory.createObject();
frame.setObject(frameObject);
Var var = factory.createVar();
var.getContent().add(contextVariable.getName());
frameObject.setVar(var);
return frame;
}
use of org.w3._2005.atom in project hale by halestudio.
the class TestModelRifToRifTranslator method checkDoElements.
private void checkDoElements(Do do1) {
assertNotNull(do1.getActionVar());
assertTrue(do1.getActionVar().size() >= 1);
// count number of news and frames in the collection
int numNews = 0;
int numFrames = 0;
for (ActionVar v : do1.getActionVar()) {
assertNotNull(v);
if (v.getNew() != null) {
numNews++;
checkActionVarTypeNew(v);
}
if (v.getFrame() != null) {
numFrames++;
checkActionVarTypeFrame(v);
}
}
assertThat(numNews, is(equalTo(1)));
int numAsserts = 0;
for (Object action : do1.getActions().getACTION()) {
assertTrue(action instanceof org.w3._2007.rif.Assert);
numAsserts++;
org.w3._2007.rif.Assert a = (org.w3._2007.rif.Assert) action;
assertNotNull(a);
checkAssertTarget(a);
}
// CHECKSTYLE:OFF
assertThat(numAsserts, is(equalTo(3)));
// CHECKSTYLE:ON
}
use of org.w3._2005.atom in project hale by halestudio.
the class TestModelRifToRifTranslator method testTranslateExample3CP.
/**
* Tests that it is possible to translate the example 3 CP source dataset.
*
* @throws TranslationException
* if any errors occurred during the translation
*/
@Test
public void testTranslateExample3CP() throws TranslationException {
URL url = getClass().getClassLoader().getResource(// $NON-NLS-1$
"com/onespatial/jrc/tnstg/oml_to_rif/alignments/example3_cp.goml");
org.w3._2007.rif.Document doc = translator.translate(url);
assertNotNull(doc);
assertNotNull(doc.getPayload());
assertNotNull(doc.getPayload().getGroup());
assertNotNull(doc.getPayload().getGroup().getSentence());
assertThat(doc.getPayload().getGroup().getSentence().size(), is(1));
assertNotNull(doc.getPayload().getGroup().getSentence().get(0));
checkJavaBindings(doc);
}
use of org.w3._2005.atom in project packages-jpl by SWI-Prolog.
the class Zahed method main.
public static void main(java.lang.String[] argv) {
System.out.println("starting...");
Compound goal1 = new Compound("consult", new Term[] { new Atom("zahed.pl") });
Query q1 = new Query(goal1);
if (!q1.hasSolution()) {
System.out.println("consult('zahed.pl') failed");
return;
}
Term t2 = new Compound("t", new Term[] { new Atom("v"), new Atom("[]"), new Atom("a") });
Compound list2 = new Compound(".", new Term[] { t2, new Atom("[]") });
Compound t1 = new Compound("t", new Term[] { new Atom("c"), new Atom("q"), new Atom("[]") });
Compound list1 = new Compound(".", new Term[] { t1, list2 });
Variable answer = new Variable("A");
Compound goal2 = new Compound("gen", new Term[] { list1, answer });
Query q2 = new Query(goal2);
Map<String, Term> solution = q2.oneSolution();
if (solution == null) {
System.out.println("failed");
} else {
System.out.println(solution.get("A").toString());
}
System.out.println("finished");
}
Aggregations