You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by jo...@apache.org on 2011/08/12 13:14:21 UTC
svn commit: r1157050 [4/11] - in
/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons: ./ .settings/
META-INF/ icons/ schema/ src/ src/main/ src/main/java/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/uima/ src/main/java/o...
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListViewFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListViewFactory.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListViewFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListViewFactory.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.explain.rulelist;
+
+import org.apache.uima.cev.data.CEVDocument;
+import org.apache.uima.cev.editor.CEVViewer;
+import org.apache.uima.cev.extension.ICEVView;
+import org.apache.uima.cev.extension.ICEVViewFactory;
+
+public class RuleListViewFactory implements ICEVViewFactory {
+
+ public RuleListViewFactory() {
+ }
+
+ public ICEVView createView(CEVViewer viewer, CEVDocument cevDocument, int index) {
+ return new RuleListViewPage(viewer, cevDocument, index);
+ }
+
+ public Class<?> getAdapterInterface() {
+ return IRuleListViewPage.class;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListViewFactory.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListViewFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListViewPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListViewPage.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListViewPage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListViewPage.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.explain.rulelist;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cev.data.CEVData;
+import org.apache.uima.cev.data.CEVDocument;
+import org.apache.uima.cev.editor.CEVViewer;
+import org.apache.uima.textmarker.explain.ExplainConstants;
+import org.apache.uima.textmarker.explain.apply.ApplyTreeContentProvider;
+import org.apache.uima.textmarker.explain.apply.ApplyTreeLabelProvider;
+import org.apache.uima.textmarker.explain.apply.ApplyViewPage;
+import org.apache.uima.textmarker.explain.tree.ApplyRootNode;
+import org.apache.uima.textmarker.explain.tree.ExplainTree;
+import org.apache.uima.textmarker.explain.tree.IExplainTreeNode;
+import org.apache.uima.textmarker.explain.tree.RuleApplyNode;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+
+public class RuleListViewPage extends ApplyViewPage implements IRuleListViewPage, Listener {
+
+ protected Text filterTextField;
+
+ protected String manualFilter = "";
+
+ private Composite overlay;
+
+ private int offset = -1;
+
+ public RuleListViewPage(CEVViewer casViewer, CEVDocument casDoc, int index) {
+ super(casViewer, casDoc, index);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ this.overlay = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ // FillLayout layout = new FillLayout(SWT.VERTICAL);
+ overlay.setLayout(layout);
+
+ filterTextField = new Text(overlay, SWT.SINGLE | SWT.BORDER);
+ GridData gd = new GridData();
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalAlignment = GridData.FILL;
+ gd.horizontalSpan = 1;
+ filterTextField.setLayoutData(gd);
+ filterTextField.setToolTipText("Retain types that contain...");
+ filterTextField.addListener(SWT.KeyUp, this);
+ filterTextField.addListener(SWT.MouseUp, this);
+ filterTextField.addListener(SWT.Modify, this);
+
+ viewer = new CheckboxTreeViewer(overlay, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ gd = new GridData(GridData.FILL_BOTH);
+ viewer.getTree().setLayoutData(gd);
+ viewer.setContentProvider(new ApplyTreeContentProvider());
+ viewer.setLabelProvider(new ApplyTreeLabelProvider(this));
+ viewer.addDoubleClickListener(this);
+ viewer.addSelectionChangedListener(this);
+ viewer.setInput(new ApplyRootNode(null, getCurrentCEVData().getCAS().getTypeSystem()));
+ }
+
+ public void viewChanged(int newIndex) {
+ getCurrentCEVData().removeAnnotationListener(this);
+ current = newIndex;
+ getCurrentCEVData().addAnnotationListener(this);
+ newSelection(offset);
+ }
+
+ public CEVData getCurrentCEVData() {
+ return casDoc.getCASData(current);
+ }
+
+ public void newSelection(int offset) {
+ this.offset = offset;
+
+ if (offset >= 0) {
+ ExplainTree tree = new ExplainTree(getCurrentCEVData(), offset, true);
+ filterTree(tree);
+ viewer.setInput(tree.getRoot());
+ viewer.refresh();
+ }
+ }
+
+ private void filterTree(ExplainTree tree) {
+ Type ruleType = getCurrentCEVData().getCAS().getTypeSystem()
+ .getType(ExplainConstants.RULE_APPLY_TYPE);
+ IExplainTreeNode root = tree.getRoot();
+ List<IExplainTreeNode> children = new ArrayList<IExplainTreeNode>(root.getChildren());
+ for (IExplainTreeNode each : children) {
+ if (each instanceof RuleApplyNode) {
+ RuleApplyNode ran = (RuleApplyNode) each;
+ Feature f = ruleType.getFeatureByBaseName(ExplainTree.ELEMENTS);
+ if (f != null) {
+ String v = ran.getFeatureStructure().getStringValue(f);
+ if (manualFilter != null && !"".equals(manualFilter) && v.indexOf(manualFilter) == -1) {
+ root.removeChild(ran);
+ }
+ }
+ }
+ }
+ }
+
+ public void handleEvent(Event event) {
+ if (event.widget == filterTextField && event.type == SWT.Modify) {
+ manualFilter = filterTextField.getText();
+ newSelection(offset);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.Page#dispose()
+ */
+ @Override
+ public void dispose() {
+ super.dispose();
+ overlay.dispose();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.Page#getControl()
+ */
+ @Override
+ public Control getControl() {
+ return overlay;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.Page#setFocus()
+ */
+ @Override
+ public void setFocus() {
+ overlay.setFocus();
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListViewPage.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListViewPage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/ExplainSelectionView.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/ExplainSelectionView.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/ExplainSelectionView.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/ExplainSelectionView.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.explain.selection;
+
+import org.apache.uima.cev.views.CEVPageBookView;
+import org.eclipse.ui.IWorkbenchPart;
+
+
+public class ExplainSelectionView extends CEVPageBookView {
+
+ public ExplainSelectionView() {
+ super();
+ }
+
+ @Override
+ protected PageRec doCreatePage(IWorkbenchPart part) {
+ return doCreatePage(part, IExplainSelectionViewPage.class);
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/ExplainSelectionView.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/ExplainSelectionView.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/ExplainSelectionViewFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/ExplainSelectionViewFactory.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/ExplainSelectionViewFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/ExplainSelectionViewFactory.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.explain.selection;
+
+import org.apache.uima.cev.data.CEVDocument;
+import org.apache.uima.cev.editor.CEVViewer;
+import org.apache.uima.cev.extension.ICEVView;
+import org.apache.uima.cev.extension.ICEVViewFactory;
+
+public class ExplainSelectionViewFactory implements ICEVViewFactory {
+
+ public ExplainSelectionViewFactory() {
+ }
+
+ public ICEVView createView(CEVViewer viewer, CEVDocument cevDocument, int index) {
+ return new ExplainSelectionViewPage(viewer, cevDocument, index);
+ }
+
+ public Class<?> getAdapterInterface() {
+ return IExplainSelectionViewPage.class;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/ExplainSelectionViewFactory.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/ExplainSelectionViewFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/ExplainSelectionViewPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/ExplainSelectionViewPage.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/ExplainSelectionViewPage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/ExplainSelectionViewPage.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.explain.selection;
+
+import org.apache.uima.cev.data.CEVDocument;
+import org.apache.uima.cev.editor.CEVViewer;
+import org.apache.uima.textmarker.explain.apply.ApplyTreeContentProvider;
+import org.apache.uima.textmarker.explain.apply.ApplyTreeLabelProvider;
+import org.apache.uima.textmarker.explain.apply.ApplyViewPage;
+import org.apache.uima.textmarker.explain.tree.ApplyRootNode;
+import org.apache.uima.textmarker.explain.tree.ExplainTree;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+
+public class ExplainSelectionViewPage extends ApplyViewPage implements IExplainSelectionViewPage {
+
+ private int offset = -1;
+
+ public ExplainSelectionViewPage(CEVViewer casViewer, CEVDocument casDoc, int index) {
+ super(casViewer, casDoc, index);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ viewer = new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
+ viewer.setContentProvider(new ApplyTreeContentProvider());
+ viewer.setLabelProvider(new ApplyTreeLabelProvider(this));
+
+ viewer.addDoubleClickListener(this);
+ viewer.addSelectionChangedListener(this);
+ viewer.setInput(new ApplyRootNode(null, getCurrentCEVData().getCAS().getTypeSystem()));
+ }
+
+ public void viewChanged(int newIndex) {
+ getCurrentCEVData().removeAnnotationListener(this);
+ current = newIndex;
+ getCurrentCEVData().addAnnotationListener(this);
+ newSelection(offset);
+ }
+
+ public void newSelection(int offset) {
+ this.offset = offset;
+
+ if (offset >= 0) {
+ ExplainTree tree = new ExplainTree(getCurrentCEVData(), offset);
+ viewer.setInput(tree.getRoot());
+ viewer.refresh();
+ }
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/ExplainSelectionViewPage.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/ExplainSelectionViewPage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/IExplainSelectionViewPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/IExplainSelectionViewPage.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/IExplainSelectionViewPage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/IExplainSelectionViewPage.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.explain.selection;
+
+import org.apache.uima.cev.views.ICEVViewPage;
+
+public interface IExplainSelectionViewPage extends ICEVViewPage {
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/IExplainSelectionViewPage.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/selection/IExplainSelectionViewPage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ApplyRootNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ApplyRootNode.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ApplyRootNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ApplyRootNode.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.explain.tree;
+
+import org.apache.uima.cas.TypeSystem;
+
+public class ApplyRootNode extends ExplainAbstractTreeNode implements ExplainRootNode {
+
+ public ApplyRootNode(IExplainTreeNode parent, TypeSystem typeSystem) {
+ super(parent, null, typeSystem);
+ }
+
+ @Override
+ public String toString() {
+ return "Applied";
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ApplyRootNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ApplyRootNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/BlockApplyNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/BlockApplyNode.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/BlockApplyNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/BlockApplyNode.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.explain.tree;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.TypeSystem;
+
+public class BlockApplyNode extends ExplainAbstractTreeNode {
+
+ private RuleApplyNode blockRuleNode;
+
+ public RuleApplyNode getBlockRuleNode() {
+ return blockRuleNode;
+ }
+
+ public BlockApplyNode(IExplainTreeNode parent, FeatureStructure fs, TypeSystem ts) {
+ super(parent, fs, ts);
+ }
+
+ public void setBlockRuleApply(RuleApplyNode ruleNode) {
+ this.blockRuleNode = ruleNode;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/BlockApplyNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/BlockApplyNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ConditionNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ConditionNode.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ConditionNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ConditionNode.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.explain.tree;
+
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.TypeSystem;
+
+public class ConditionNode extends ExplainAbstractTreeNode implements IEvaluatedNode {
+
+ private boolean matched;
+
+ public ConditionNode(IExplainTreeNode parent, FeatureStructure fs, TypeSystem ts) {
+ super(parent, fs, ts);
+ Feature f = fs.getType().getFeatureByBaseName(ExplainTree.VALUE);
+ matched = fs.getBooleanValue(f);
+ }
+
+ public boolean matched() {
+ return matched;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ConditionNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ConditionNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ExplainAbstractTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ExplainAbstractTreeNode.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ExplainAbstractTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ExplainAbstractTreeNode.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.explain.tree;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.TypeSystem;
+
+public abstract class ExplainAbstractTreeNode implements IExplainTreeNode {
+
+ private IExplainTreeNode parent;
+
+ private List<IExplainTreeNode> children;
+
+ private FeatureStructure fs;
+
+ private TypeSystem ts;
+
+ public ExplainAbstractTreeNode(IExplainTreeNode parent, FeatureStructure fs, TypeSystem ts) {
+ this.parent = parent;
+ this.children = new ArrayList<IExplainTreeNode>();
+ this.fs = fs;
+ this.ts = ts;
+ }
+
+ public IExplainTreeNode getParent() {
+ return parent;
+ }
+
+ public List<IExplainTreeNode> getChildren() {
+ return children;
+ }
+
+ public boolean hasChildren() {
+ if (children.size() > 0) {
+ return true;
+ }
+ return false;
+ }
+
+ public void addChild(IExplainTreeNode child) {
+ children.add(child);
+ }
+
+ public boolean removeChild(IExplainTreeNode child) {
+ return children.remove(child);
+ }
+
+ public FeatureStructure getFeatureStructure() {
+ return fs;
+ }
+
+ public TypeSystem getTypeSystem() {
+ return ts;
+ }
+
+ @Override
+ public String toString() {
+ return fs.toString();
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ExplainAbstractTreeNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ExplainAbstractTreeNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ExplainRootNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ExplainRootNode.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ExplainRootNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ExplainRootNode.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.explain.tree;
+
+public interface ExplainRootNode {
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ExplainRootNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ExplainRootNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ExplainTree.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ExplainTree.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ExplainTree.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ExplainTree.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,348 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.explain.tree;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.uima.cas.ArrayFS;
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.cev.data.CEVData;
+import org.apache.uima.textmarker.explain.ExplainConstants;
+
+public class ExplainTree {
+
+ public static final String BASE_CONDITION = "baseCondition";
+
+ public static final String MATCHES = "matches";
+
+ public static final String ELEMENTS = "elements";
+
+ public static final String MATCHED = "matched";
+
+ public static final String DELEGATES = "delegates";
+
+ public static final String RULES = "rules";
+
+ public static final String INNER_APPLY = "innerApply";
+
+ public static final String CONDITIONS = "conditions";
+
+ public static final String VALUE = "value";
+
+ public static final String APPLIED = "applied";
+
+ public static final String TRIED = "tried";
+
+ public static final String ELEMENT = "element";
+
+ public static final String TIME = "time";
+
+ private IExplainTreeNode root;
+
+ private Type ruleMatchType;
+
+ private Type blockApplyType;
+
+ private Type ruleApplyType;
+
+ private Type ruleElementMatchType;
+
+ private Type ruleElementMatchesType;
+
+ private Type evaluatedConditionType;
+
+ private Type matchedRuleMatchType;
+
+ private Type failedRuleMatchType;
+
+ public ExplainTree(CEVData casData) {
+ this(casData, -1);
+ }
+
+ public ExplainTree(CEVData casData, int offset) {
+ this(casData, offset, false);
+ if (offset >= 0) {
+ prune(root);
+ }
+ }
+
+ public ExplainTree(CEVData casData, int offset, boolean onlyRules) {
+ createTree(casData, offset, onlyRules);
+ }
+
+ public IExplainTreeNode getRoot() {
+ return root;
+ }
+
+ private void createTree(CEVData casData, int offset, boolean onlyRules) {
+ TypeSystem ts = casData.getCAS().getTypeSystem();
+ Type scriptApply = ts.getType(ExplainConstants.SCRIPT_APPLY_TYPE);
+
+ blockApplyType = ts.getType(ExplainConstants.BLOCK_APPLY_TYPE);
+ ruleApplyType = ts.getType(ExplainConstants.RULE_APPLY_TYPE);
+ ruleMatchType = ts.getType(ExplainConstants.RULE_MATCH_TYPE);
+ matchedRuleMatchType = ts.getType(ExplainConstants.MATCHED_RULE_MATCH_TYPE);
+ failedRuleMatchType = ts.getType(ExplainConstants.FAILED_RULE_MATCH_TYPE);
+ ruleElementMatchType = ts.getType(ExplainConstants.RULE_ELEMENT_MATCH_TYPE);
+ ruleElementMatchesType = ts.getType(ExplainConstants.RULE_ELEMENT_MATCHES_TYPE);
+ evaluatedConditionType = ts.getType(ExplainConstants.EVAL_CONDITION_TYPE);
+
+ if (scriptApply == null)
+ return;
+ FSIterator<AnnotationFS> it = casData.getCAS().getAnnotationIndex(scriptApply).iterator();
+ root = new ApplyRootNode(null, ts);
+
+ if (it.isValid()) {
+ it.moveToFirst();
+ while (it.isValid()) {
+ AnnotationFS fs = it.get();
+ buildTree(fs, root, ts, offset, onlyRules);
+ it.moveToNext();
+ }
+ }
+
+ }
+
+ private void buildTree(FeatureStructure fs, IExplainTreeNode parent, TypeSystem ts, int offset,
+ boolean onlyRules) {
+ if (blockApplyType != null && blockApplyType.equals(fs.getType())) {
+ processBlockApply((AnnotationFS) fs, parent, ts, offset, onlyRules);
+ } else if (ruleApplyType != null && ruleApplyType.equals(fs.getType())) {
+ processRuleApply((AnnotationFS) fs, parent, ts, offset, onlyRules);
+ } else if ((matchedRuleMatchType != null && matchedRuleMatchType.equals(fs.getType()))
+ || (failedRuleMatchType != null && failedRuleMatchType.equals(fs.getType()))) {
+ processRuleMatch((AnnotationFS) fs, parent, ts, offset, onlyRules);
+ } else if (ruleElementMatchesType != null && ruleElementMatchesType.equals(fs.getType())) {
+ processRuleElementMatches(fs, parent, ts, offset, onlyRules);
+ } else if (ruleElementMatchType != null && ruleElementMatchType.equals(fs.getType())) {
+ processRuleElementMatch((AnnotationFS) fs, parent, ts, offset, onlyRules);
+ } else if (evaluatedConditionType != null && evaluatedConditionType.equals(fs.getType())) {
+ processEvaluatedCondition(fs, parent, ts, offset, onlyRules);
+ }
+ }
+
+ private void processBlockApply(AnnotationFS fs, IExplainTreeNode parent, TypeSystem ts,
+ int offset, boolean onlyRules) {
+ if (offset >= 0 && (fs.getBegin() >= offset || fs.getEnd() <= offset)) {
+ return;
+ }
+ BlockApplyNode blockNode = null;
+ if (!onlyRules) {
+ blockNode = new BlockApplyNode(parent, fs, ts);
+ parent.addChild(blockNode);
+ processBlockRuleApply(fs, blockNode, ts, offset, onlyRules);
+ }
+ Feature feature = blockApplyType.getFeatureByBaseName(INNER_APPLY);
+ FeatureStructure featureValue = fs.getFeatureValue(feature);
+ ArrayFS value = (ArrayFS) featureValue;
+ FeatureStructure[] fsarray = value.toArray();
+ for (FeatureStructure each : fsarray) {
+ if (!onlyRules) {
+ buildTree(each, blockNode, ts, offset, onlyRules);
+ } else {
+ buildTree(each, parent, ts, offset, onlyRules);
+ }
+
+ }
+ }
+
+ private void processBlockRuleApply(AnnotationFS fs, BlockApplyNode parent, TypeSystem ts,
+ int offset, boolean onlyRules) {
+ if (offset >= 0 && (fs.getBegin() >= offset || fs.getEnd() <= offset)) {
+ return;
+ }
+ RuleApplyNode ruleNode = new RuleApplyNode(parent, fs, ts);
+ parent.setBlockRuleApply(ruleNode);
+
+ Feature feature = ruleApplyType.getFeatureByBaseName(RULES);
+ ArrayFS value = (ArrayFS) fs.getFeatureValue(feature);
+ if (value == null)
+ return;
+ FeatureStructure[] fsarray = value.toArray();
+
+ MatchedRootNode matched = new MatchedRootNode(ruleNode, ts);
+ FailedRootNode failed = new FailedRootNode(ruleNode, ts);
+ ruleNode.addChild(matched);
+ ruleNode.addChild(failed);
+
+ for (FeatureStructure eachRuleMatch : fsarray) {
+ Feature f = eachRuleMatch.getType().getFeatureByBaseName(MATCHED);
+ boolean matchedValue = eachRuleMatch.getBooleanValue(f);
+ if (matchedValue) {
+ buildTree(eachRuleMatch, matched, ts, offset, onlyRules);
+ } else {
+ buildTree(eachRuleMatch, failed, ts, offset, onlyRules);
+ }
+
+ Feature df = eachRuleMatch.getType().getFeatureByBaseName(DELEGATES);
+ if (df != null) {
+ ArrayFS dv = (ArrayFS) eachRuleMatch.getFeatureValue(df);
+ if (dv != null) {
+ FeatureStructure[] da = dv.toArray();
+ for (FeatureStructure delegateFS : da) {
+ buildTree(delegateFS, ruleNode, ts, offset, onlyRules);
+ }
+ }
+ }
+
+ }
+ }
+
+ private void processRuleApply(AnnotationFS fs, IExplainTreeNode parent, TypeSystem ts,
+ int offset, boolean onlyRules) {
+ if (offset >= 0 && (fs.getBegin() >= offset || fs.getEnd() <= offset)) {
+ return;
+ }
+ RuleApplyNode ruleNode = new RuleApplyNode(parent, fs, ts);
+ parent.addChild(ruleNode);
+
+ Feature feature = ruleApplyType.getFeatureByBaseName(RULES);
+ ArrayFS value = (ArrayFS) fs.getFeatureValue(feature);
+ FeatureStructure[] fsarray = value.toArray();
+
+ MatchedRootNode matched = new MatchedRootNode(ruleNode, ts);
+ FailedRootNode failed = new FailedRootNode(ruleNode, ts);
+ ruleNode.addChild(matched);
+ ruleNode.addChild(failed);
+
+ for (FeatureStructure eachRuleMatch : fsarray) {
+ Feature f = eachRuleMatch.getType().getFeatureByBaseName(MATCHED);
+ boolean matchedValue = eachRuleMatch.getBooleanValue(f);
+ if (matchedValue) {
+ buildTree(eachRuleMatch, matched, ts, offset, onlyRules);
+ } else {
+ buildTree(eachRuleMatch, failed, ts, offset, onlyRules);
+ }
+
+ Feature df = eachRuleMatch.getType().getFeatureByBaseName(DELEGATES);
+ if (df != null) {
+ ArrayFS dv = (ArrayFS) eachRuleMatch.getFeatureValue(df);
+ if (dv != null) {
+ FeatureStructure[] da = dv.toArray();
+ for (FeatureStructure delegateFS : da) {
+ buildTree(delegateFS, ruleNode, ts, offset, onlyRules);
+ }
+ }
+ }
+
+ }
+ }
+
+ private void processRuleMatch(AnnotationFS fs, IExplainTreeNode parent, TypeSystem ts,
+ int offset, boolean onlyRules) {
+ if (offset >= 0 && (fs.getBegin() >= offset || fs.getEnd() <= offset)) {
+ return;
+ }
+ RuleMatchNode matchNode = new RuleMatchNode(parent, fs, ts);
+ parent.addChild(matchNode);
+
+ RuleElementRootNode remRoot = new RuleElementRootNode(matchNode, ts);
+ matchNode.addChild(remRoot);
+
+ Feature feature = ruleMatchType.getFeatureByBaseName(ELEMENTS);
+ ArrayFS value = (ArrayFS) fs.getFeatureValue(feature);
+ FeatureStructure[] fsarray = value.toArray();
+ for (FeatureStructure each : fsarray) {
+ buildTree(each, remRoot, ts, offset, onlyRules);
+ }
+ }
+
+ private void processRuleElementMatches(FeatureStructure fs, IExplainTreeNode parent,
+ TypeSystem ts, int offset, boolean onlyRules) {
+ RuleElementMatchesNode remsNode = new RuleElementMatchesNode(parent, fs, ts);
+ parent.addChild(remsNode);
+
+ Feature feature = ruleElementMatchesType.getFeatureByBaseName(MATCHES);
+ ArrayFS value = (ArrayFS) fs.getFeatureValue(feature);
+ FeatureStructure[] fsarray = value.toArray();
+ for (FeatureStructure each : fsarray) {
+ buildTree(each, remsNode, ts, offset, onlyRules);
+ }
+ }
+
+ private void processRuleElementMatch(AnnotationFS fs, IExplainTreeNode parent, TypeSystem ts,
+ int offset, boolean onlyRules) {
+ if (offset >= 0 && (fs.getBegin() >= offset || fs.getEnd() <= offset)) {
+ return;
+ }
+ RuleElementMatchNode remNode = new RuleElementMatchNode(parent, fs, ts);
+ parent.addChild(remNode);
+
+ Feature feature = ruleElementMatchType.getFeatureByBaseName(BASE_CONDITION);
+ FeatureStructure base = fs.getFeatureValue(feature);
+ buildTree(base, remNode, ts, offset, onlyRules);
+
+ feature = ruleElementMatchType.getFeatureByBaseName(CONDITIONS);
+ ArrayFS value = (ArrayFS) fs.getFeatureValue(feature);
+ FeatureStructure[] fsarray = value.toArray();
+ for (FeatureStructure each : fsarray) {
+ buildTree(each, remNode, ts, offset, onlyRules);
+ }
+ }
+
+ private void processEvaluatedCondition(FeatureStructure fs, IExplainTreeNode parent,
+ TypeSystem ts, int offset, boolean onlyRules) {
+ ConditionNode condNode = new ConditionNode(parent, fs, ts);
+ parent.addChild(condNode);
+
+ Feature feature = evaluatedConditionType.getFeatureByBaseName(CONDITIONS);
+ ArrayFS value = (ArrayFS) fs.getFeatureValue(feature);
+ if (value != null) {
+ FeatureStructure[] fsarray = value.toArray();
+ for (FeatureStructure each : fsarray) {
+ buildTree(each, condNode, ts, offset, onlyRules);
+ }
+ }
+ }
+
+ private void prune(IExplainTreeNode node) {
+ List<IExplainTreeNode> children = node.getChildren();
+ IExplainTreeNode parent = node.getParent();
+ for (IExplainTreeNode each : new ArrayList<IExplainTreeNode>(children)) {
+ prune(each);
+ }
+ if (node instanceof ApplyRootNode) {
+ } else if (node instanceof BlockApplyNode) {
+ } else if (node instanceof ConditionNode) {
+ } else if (node instanceof FailedRootNode) {
+ if (!node.hasChildren()) {
+ parent.removeChild(node);
+ }
+ } else if (node instanceof MatchedRootNode) {
+ if (!node.hasChildren()) {
+ parent.removeChild(node);
+ }
+ } else if (node instanceof RuleApplyNode) {
+ if (!node.hasChildren()) {
+ parent.removeChild(node);
+ }
+ } else if (node instanceof RuleElementMatchesNode) {
+ } else if (node instanceof RuleElementMatchNode) {
+ } else if (node instanceof RuleElementRootNode) {
+ } else if (node instanceof RuleMatchNode) {
+ }
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ExplainTree.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/ExplainTree.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/FailedRootNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/FailedRootNode.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/FailedRootNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/FailedRootNode.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.explain.tree;
+
+import org.apache.uima.cas.TypeSystem;
+
+public class FailedRootNode extends ExplainAbstractTreeNode implements ExplainRootNode {
+
+ public FailedRootNode(IExplainTreeNode parent, TypeSystem ts) {
+ super(parent, null, ts);
+ }
+
+ @Override
+ public String toString() {
+ return "Failed";
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/FailedRootNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/FailedRootNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/IEvaluatedNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/IEvaluatedNode.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/IEvaluatedNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/IEvaluatedNode.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.explain.tree;
+
+public interface IEvaluatedNode {
+
+ boolean matched();
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/IEvaluatedNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/IEvaluatedNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/IExplainTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/IExplainTreeNode.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/IExplainTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/IExplainTreeNode.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.explain.tree;
+
+import java.util.List;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.TypeSystem;
+
+public interface IExplainTreeNode {
+
+ IExplainTreeNode getParent();
+
+ List<IExplainTreeNode> getChildren();
+
+ boolean hasChildren();
+
+ void addChild(IExplainTreeNode node);
+
+ boolean removeChild(IExplainTreeNode node);
+
+ FeatureStructure getFeatureStructure();
+
+ TypeSystem getTypeSystem();
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/IExplainTreeNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/IExplainTreeNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/MatchedRootNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/MatchedRootNode.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/MatchedRootNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/MatchedRootNode.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.explain.tree;
+
+import org.apache.uima.cas.TypeSystem;
+
+public class MatchedRootNode extends ExplainAbstractTreeNode implements ExplainRootNode {
+
+ public MatchedRootNode(IExplainTreeNode parent, TypeSystem ts) {
+ super(parent, null, ts);
+ }
+
+ @Override
+ public String toString() {
+ return "Matched";
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/MatchedRootNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/MatchedRootNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleApplyNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleApplyNode.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleApplyNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleApplyNode.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.explain.tree;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.TypeSystem;
+
+public class RuleApplyNode extends ExplainAbstractTreeNode {
+
+ private FailedRootNode failedNode;
+
+ private MatchedRootNode matchedNode;
+
+ public RuleApplyNode(IExplainTreeNode parent, FeatureStructure fs, TypeSystem ts) {
+ super(parent, fs, ts);
+ }
+
+ @Override
+ public void addChild(IExplainTreeNode node) {
+ super.addChild(node);
+ if (node instanceof FailedRootNode) {
+ failedNode = (FailedRootNode) node;
+ } else if (node instanceof MatchedRootNode) {
+ matchedNode = (MatchedRootNode) node;
+ }
+ }
+
+ public FailedRootNode getFailedNode() {
+ return failedNode;
+ }
+
+ public MatchedRootNode getMatchedChild() {
+ return matchedNode;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleApplyNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleApplyNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleElementMatchNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleElementMatchNode.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleElementMatchNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleElementMatchNode.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.explain.tree;
+
+import org.apache.uima.cas.ArrayFS;
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.cev.data.tree.ICEVAnnotationNode;
+
+
+public class RuleElementMatchNode extends ExplainAbstractTreeNode implements IEvaluatedNode,
+ ICEVAnnotationNode {
+
+ private boolean matched;
+
+ public RuleElementMatchNode(IExplainTreeNode parent, FeatureStructure fs, TypeSystem ts) {
+ super(parent, fs, ts);
+ Feature f = fs.getType().getFeatureByBaseName(ExplainTree.BASE_CONDITION);
+ FeatureStructure baseFS = fs.getFeatureValue(f);
+ Feature baseFeat = baseFS.getType().getFeatureByBaseName(ExplainTree.VALUE);
+ matched = baseFS.getBooleanValue(baseFeat);
+
+ f = fs.getType().getFeatureByBaseName(ExplainTree.CONDITIONS);
+ ArrayFS value = (ArrayFS) fs.getFeatureValue(f);
+ FeatureStructure[] fsarray = value.toArray();
+ for (FeatureStructure each : fsarray) {
+ Feature eachFeat = each.getType().getFeatureByBaseName(ExplainTree.VALUE);
+ boolean eachValue = each.getBooleanValue(eachFeat);
+ matched &= eachValue;
+ }
+ }
+
+ public boolean matched() {
+ return matched;
+ }
+
+ public AnnotationFS getAnnotation() {
+ FeatureStructure fs = getFeatureStructure();
+ if (fs instanceof AnnotationFS) {
+ return (AnnotationFS) fs;
+ }
+ return null;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleElementMatchNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleElementMatchNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleElementMatchesNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleElementMatchesNode.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleElementMatchesNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleElementMatchesNode.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.explain.tree;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.TypeSystem;
+
+public class RuleElementMatchesNode extends ExplainAbstractTreeNode implements IEvaluatedNode {
+
+ public RuleElementMatchesNode(IExplainTreeNode parent, FeatureStructure fs, TypeSystem ts) {
+ super(parent, fs, ts);
+ }
+
+ public boolean matched() {
+ boolean result = true;
+ for (IExplainTreeNode each : getChildren()) {
+ if (each instanceof IEvaluatedNode) {
+ result &= ((IEvaluatedNode) each).matched();
+ }
+ }
+ return result;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleElementMatchesNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleElementMatchesNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleElementRootNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleElementRootNode.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleElementRootNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleElementRootNode.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.explain.tree;
+
+import org.apache.uima.cas.TypeSystem;
+
+public class RuleElementRootNode extends ExplainAbstractTreeNode implements ExplainRootNode {
+
+ public RuleElementRootNode(IExplainTreeNode parent, TypeSystem ts) {
+ super(parent, null, ts);
+ }
+
+ @Override
+ public String toString() {
+ return "Element";
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleElementRootNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleElementRootNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleMatchNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleMatchNode.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleMatchNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleMatchNode.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.explain.tree;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.cev.data.tree.ICEVAnnotationNode;
+
+
+public class RuleMatchNode extends ExplainAbstractTreeNode implements ICEVAnnotationNode {
+
+ public RuleMatchNode(IExplainTreeNode parent, FeatureStructure fs, TypeSystem ts) {
+ super(parent, fs, ts);
+ }
+
+ public AnnotationFS getAnnotation() {
+ FeatureStructure fs = getFeatureStructure();
+ if (fs instanceof AnnotationFS) {
+ return (AnnotationFS) fs;
+ }
+ return null;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleMatchNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/tree/RuleMatchNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/QuerySearchStrategy.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/QuerySearchStrategy.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/QuerySearchStrategy.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/QuerySearchStrategy.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.query;
+
+import org.apache.uima.cev.extension.ICEVSearchStrategy;
+import org.eclipse.core.resources.IFile;
+
+
+public class QuerySearchStrategy implements ICEVSearchStrategy {
+
+ private int priority;
+
+ public QuerySearchStrategy(int priority) {
+
+ this.priority = priority;
+ }
+
+ @Override
+ public int getPriority() {
+ return priority;
+ }
+
+ @Override
+ public IFile searchDescriptor(IFile file) {
+ // TODO: add strategy
+ return null;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/QuerySearchStrategy.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/QuerySearchStrategy.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/QuerySearchStrategyFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/QuerySearchStrategyFactory.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/QuerySearchStrategyFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/QuerySearchStrategyFactory.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.query;
+
+import org.apache.uima.cev.extension.ICEVSearchStrategy;
+import org.apache.uima.cev.extension.ICEVSearchStrategyFactory;
+
+public class QuerySearchStrategyFactory implements ICEVSearchStrategyFactory {
+
+ public QuerySearchStrategyFactory() {
+ super();
+ }
+
+ @Override
+ public ICEVSearchStrategy createSearchStrategy(int priority) {
+ return new QuerySearchStrategy(priority);
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/QuerySearchStrategyFactory.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/QuerySearchStrategyFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/BasicEngine.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/BasicEngine.xml?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/BasicEngine.xml (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/BasicEngine.xml Fri Aug 12 11:14:14 2011
@@ -0,0 +1,249 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <primitive>true</primitive>
+ <annotatorImplementationName>org.apache.uima.textmarker.engine.TextMarkerEngine</annotatorImplementationName>
+ <analysisEngineMetaData>
+ <name>BasicEngine</name>
+ <description/>
+ <version>1.0</version>
+ <vendor/>
+ <configurationParameters searchStrategy="language_fallback">
+ <configurationParameter>
+ <name>seeders</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>debug</name>
+ <type>Boolean</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>style</name>
+ <type>Boolean</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>styleMap</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>additionalScripts</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>profile</name>
+ <type>Boolean</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>debugWithMatches</name>
+ <type>Boolean</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>statistics</name>
+ <type>Boolean</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>additionalEngines</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>additionalExtensions</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>debugOnlyFor</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>scriptEncoding</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>additionalEngineLoaders</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>resourcePaths</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>defaultFilteredTypes</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>defaultFilteredMarkups</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>mainScript</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>scriptPaths</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>descriptorPaths</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>useBasics</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>removeBasics</name>
+ <type>Boolean</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ </configurationParameters>
+ <configurationParameterSettings>
+ <nameValuePair>
+ <name>debug</name>
+ <value>
+ <boolean>false</boolean>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>profile</name>
+ <value>
+ <boolean>false</boolean>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>debugWithMatches</name>
+ <value>
+ <boolean>true</boolean>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>defaultFilteredTypes</name>
+ <value>
+ <array>
+ <string>org.apache.uima.textmarker.type.SPACE</string>
+ <string>org.apache.uima.textmarker.type.NBSP</string>
+ <string>org.apache.uima.textmarker.type.BREAK</string>
+ <string>org.apache.uima.textmarker.type.MARKUP</string>
+ </array>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>removeBasics</name>
+ <value>
+ <boolean>false</boolean>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>seeders</name>
+ <value>
+ <array>
+ <string>org.apache.uima.textmarker.seed.DefaultSeeder</string>
+ </array>
+ </value>
+ </nameValuePair>
+ </configurationParameterSettings>
+ <typeSystemDescription>
+ <imports>
+ <import location="BasicTypeSystem.xml"/>
+ </imports>
+ </typeSystemDescription>
+ <typePriorities>
+ <priorityList>
+ <type>org.apache.uima.textmarker.type.TextMarkerFrame</type>
+ <type>uima.tcas.Annotation</type>
+ <type>org.apache.uima.textmarker.type.TextMarkerBasic</type>
+ </priorityList>
+ </typePriorities>
+ <fsIndexCollection/>
+ <capabilities>
+ <capability>
+ <inputs/>
+ <outputs/>
+ <languagesSupported/>
+ </capability>
+ </capabilities>
+ <operationalProperties>
+ <modifiesCas>true</modifiesCas>
+ <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+ <outputsNewCASes>true</outputsNewCASes>
+ </operationalProperties>
+ </analysisEngineMetaData>
+ <resourceManagerConfiguration/>
+</analysisEngineDescription>
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/BasicEngine.xml
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/BasicEngine.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain