use of org.whole.lang.semantics.factories.SemanticsEntityFactory in project whole by wholeplatform.
the class SemanticsUtils method createTerm.
public static IEntity createTerm(String edUri, FreshNameGenerator nameGenerator) {
EntityDescriptor<?> ed = CommonsDataTypePersistenceParser.getEntityDescriptor(edUri, false, null);
if (ed == null || (!EntityUtils.isSimple(ed) && !EntityUtils.isFragment(ed)))
return SemanticsEntityFactory.instance.createEntityType(edUri);
int size = ed.featureSize();
IEntity[] values = new IEntity[size];
SemanticsEntityFactory sf = SemanticsEntityFactory.instance;
for (int i = 0; i < size; i++) {
FeatureDescriptor fd = ed.getEntityFeatureDescriptor(i);
values[i] = sf.buildTypedVariable().set(SemanticsFeatureDescriptorEnum.variable, sf.createVariable(nameGenerator.nextFreshName(fd.getName()))).set(SemanticsFeatureDescriptorEnum.signature, sf.createEntityType(fd.getEntityDescriptor().toString())).getResult();
}
return CommonsEntityFactory.instance.createStageUpFragment(GenericEntityFactory.instance.create(ed, values).wGetAdapter(CommonsEntityDescriptorEnum.Any));
}
Aggregations