Search in sources :

Example 1 with Mismatch

use of eu.xsdi.mdl.model.Mismatch in project hale by halestudio.

the class MismatchTreeContentProvider method getChildren.

/* (non-Javadoc)
	 * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
	 */
@SuppressWarnings("unchecked")
@Override
public Object[] getChildren(Object parentElement) {
    Object[] result;
    if (parentElement instanceof Mismatch) {
        Mismatch m = (Mismatch) parentElement;
        result = new Object[2];
        result[0] = m.getReason();
        result[1] = m.getConsequences();
    } else if (parentElement instanceof Set) {
        Set s = (Set) parentElement;
        result = s.toArray();
    } else if (parentElement instanceof Consequence) {
        result = new Object[0];
    } else {
        result = new Object[0];
    }
    return result;
}
Also used : Set(java.util.Set) Consequence(eu.xsdi.mdl.model.Consequence) Mismatch(eu.xsdi.mdl.model.Mismatch)

Example 2 with Mismatch

use of eu.xsdi.mdl.model.Mismatch in project hale by halestudio.

the class MismatchDetailsPage method selectionChanged.

/* (non-Javadoc)
	 * @see org.eclipse.ui.forms.IPartSelectionListener#selectionChanged(org.eclipse.ui.forms.IFormPart, org.eclipse.jface.viewers.ISelection)
	 */
@Override
public void selectionChanged(IFormPart part, ISelection selection) {
    IStructuredSelection ssel = (IStructuredSelection) selection;
    Mismatch input = null;
    if (ssel.size() == 1) {
        input = (Mismatch) ssel.getFirstElement();
        this.textType.setText(input.getType().toString());
        this.textStatus.setText(input.getStatus().toString());
        if (input.getProvenance() != null) {
            this.textProvenance.setText(input.getProvenance());
        }
        if (input.getComment() != null) {
            this.textComment.setText(input.getComment());
        }
        if (input.getReason() != null) {
            this.reasonTreeViewer.setInput(Arrays.asList(new Object[] { input.getReason() }));
        }
        if (input.getConsequences() != null) {
            this.consequenceTreeViewer.setInput(input.getConsequences());
        }
    }
}
Also used : IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Mismatch(eu.xsdi.mdl.model.Mismatch)

Example 3 with Mismatch

use of eu.xsdi.mdl.model.Mismatch in project hale by halestudio.

the class MismatchPropertiesBlock method getDummyCell.

private Object getDummyCell() {
    Mismatch a = new Mismatch(MismatchType.AggregationLevelMismatch);
    a.setReason(new Reason(new FeatureClass(new About("FC1")), new FeatureClass(new About("FC2")), EntityCharacteristic.AssociationCardinalityConstraint));
    a.getConsequences().add(new Consequence());
    a.getConsequences().add(new Consequence());
    a.getConsequences().add(new Consequence());
    a.setProvenance("HALE MDL Inference Engine");
    Mismatch b = new Mismatch(MismatchType.StructureMismatch);
    b.setReason(new Reason(new Property(new About("Prop1Name")), new Property(new About("Prop2Name")), EntityCharacteristic.AttributeTypeConstraint));
    b.getReason().setReasonRule(new ReasonRule(new ReasonSet("Prop1Name"), new ReasonSet("Prop2Name")));
    List<ReasonCondition> conditions = new ArrayList<ReasonCondition>();
    conditions.add(new ReasonCondition("attributeName", "attributeFilterValue", null));
    b.getReason().getReasonRule().getSet1().setConditions(conditions);
    b.getReason().getReasonRule().getSet1().setSubSet(new ReasonSet("SubProp1Name"));
    b.getConsequences().add(new Consequence());
    b.setProvenance("User");
    Mismatch c = new Mismatch(MismatchType.AbstractionMismatch);
    c.setReason(new Reason(new Property(new About("Prop3Name")), new Property(new About("Prop4Name")), EntityCharacteristic.AttributeDerivedPopulatedValues));
    c.getReason().setReasonRule(new ReasonRule(new ReasonSet("Prop3Name"), new ReasonSet("Prop4Name")));
    c.getConsequences().add(new Consequence());
    c.getConsequences().add(new Consequence());
    c.setProvenance("HALE MDL Inference Engine");
    MismatchCell mc = new MismatchCell();
    mc.getMismatches().add(a);
    mc.getMismatches().add(b);
    mc.getMismatches().add(c);
    return mc;
}
Also used : ReasonRule(eu.xsdi.mdl.model.reason.ReasonRule) ReasonSet(eu.xsdi.mdl.model.reason.ReasonSet) ArrayList(java.util.ArrayList) Consequence(eu.xsdi.mdl.model.Consequence) ReasonCondition(eu.xsdi.mdl.model.reason.ReasonCondition) MismatchCell(eu.xsdi.mdl.model.MismatchCell) Mismatch(eu.xsdi.mdl.model.Mismatch) FeatureClass(eu.esdihumboldt.commons.goml.omwg.FeatureClass) Property(eu.esdihumboldt.commons.goml.omwg.Property) Reason(eu.xsdi.mdl.model.Reason) About(eu.esdihumboldt.commons.goml.rdf.About)

Aggregations

Mismatch (eu.xsdi.mdl.model.Mismatch)3 Consequence (eu.xsdi.mdl.model.Consequence)2 FeatureClass (eu.esdihumboldt.commons.goml.omwg.FeatureClass)1 Property (eu.esdihumboldt.commons.goml.omwg.Property)1 About (eu.esdihumboldt.commons.goml.rdf.About)1 MismatchCell (eu.xsdi.mdl.model.MismatchCell)1 Reason (eu.xsdi.mdl.model.Reason)1 ReasonCondition (eu.xsdi.mdl.model.reason.ReasonCondition)1 ReasonRule (eu.xsdi.mdl.model.reason.ReasonRule)1 ReasonSet (eu.xsdi.mdl.model.reason.ReasonSet)1 ArrayList (java.util.ArrayList)1 Set (java.util.Set)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1