Révision 3313

TXM/trunk/org.txm.treesearch.core/plugin.xml (revision 3313)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.4"?>
3
<plugin>
4
   <extension-point id="org.txm.treesearch.TreeSearchSelector" name="org.txm.treesearch.TreeSearchSelector" schema="schema/org.txm.treesearch.TreeSearchSelector.exsd"/>
5
   <extension
6
         point="org.eclipse.core.runtime.preferences">
7
      <initializer
8
            class="org.txm.treesearch.preferences.TreeSearchPreferences">
9
      </initializer>
10
   </extension>
11

  
12
</plugin>
0 13

  
TXM/trunk/org.txm.treesearch.core/.settings/org.eclipse.jdt.core.prefs (revision 3313)
1
eclipse.preferences.version=1
2
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4
org.eclipse.jdt.core.compiler.compliance=1.8
5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7
org.eclipse.jdt.core.compiler.source=1.8
0 8

  
TXM/trunk/org.txm.treesearch.core/.classpath (revision 3313)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
5
		<accessrules>
6
			<accessrule kind="accessible" pattern="**"/>
7
		</accessrules>
8
	</classpathentry>
9
	<classpathentry kind="src" path="src"/>
10
	<classpathentry kind="output" path="bin"/>
11
</classpath>
0 12

  
TXM/trunk/org.txm.treesearch.core/META-INF/MANIFEST.MF (revision 3313)
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
3
Bundle-Name: org.txm.treesearch.core
4
Bundle-SymbolicName: org.txm.treesearch.core;singleton:=true
5
Bundle-Version: 1.0.0.qualifier
6
Automatic-Module-Name: org.txm.treesearch.rcp
7
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
8
Export-Package: org.txm.treesearch.function,
9
 org.txm.treesearch.preferences
10
Require-Bundle: org.txm.core;bundle-version="0.8.2";visibility:=reexport,
11
 org.txm.searchengine.cqp.core;bundle-version="1.1.0";visibility:=reexport
0 12

  
TXM/trunk/org.txm.treesearch.core/schema/org.txm.treesearch.TreeSearchSelector.exsd (revision 3313)
1
<?xml version='1.0' encoding='UTF-8'?>
2
<!-- Schema file written by PDE -->
3
<schema targetNamespace="org.txm.treesearch.core" xmlns="http://www.w3.org/2001/XMLSchema">
4
<annotation>
5
      <appinfo>
6
         <meta.schema plugin="org.txm.treesearch.core" id="org.txm.treesearch.TreeSearchSelector" name="org.txm.treesearch.TreeSearchSelector"/>
7
      </appinfo>
8
      <documentation>
9
         [Enter description of this extension point.]
10
      </documentation>
11
   </annotation>
12

  
13
   <element name="extension">
14
      <annotation>
15
         <appinfo>
16
            <meta.element />
17
         </appinfo>
18
      </annotation>
19
      <complexType>
20
         <choice>
21
            <element ref="TreeSearchSelector"/>
22
         </choice>
23
         <attribute name="point" type="string" use="required">
24
            <annotation>
25
               <documentation>
26
                  
27
               </documentation>
28
            </annotation>
29
         </attribute>
30
         <attribute name="id" type="string">
31
            <annotation>
32
               <documentation>
33
                  
34
               </documentation>
35
            </annotation>
36
         </attribute>
37
         <attribute name="name" type="string">
38
            <annotation>
39
               <documentation>
40
                  
41
               </documentation>
42
               <appinfo>
43
                  <meta.attribute translatable="true"/>
44
               </appinfo>
45
            </annotation>
46
         </attribute>
47
      </complexType>
48
   </element>
49

  
50
   <element name="TreeSearchSelector">
51
      <complexType>
52
         <attribute name="class" type="string">
53
            <annotation>
54
               <documentation>
55
                  
56
               </documentation>
57
               <appinfo>
58
                  <meta.attribute kind="java" basedOn="org.txm.treesearch.TreeSearchSelector:"/>
59
               </appinfo>
60
            </annotation>
61
         </attribute>
62
      </complexType>
63
   </element>
64

  
65
   <annotation>
66
      <appinfo>
67
         <meta.section type="since"/>
68
      </appinfo>
69
      <documentation>
70
         [Enter the first release in which this extension point appears.]
71
      </documentation>
72
   </annotation>
73

  
74
   <annotation>
75
      <appinfo>
76
         <meta.section type="examples"/>
77
      </appinfo>
78
      <documentation>
79
         [Enter extension point usage example here.]
80
      </documentation>
81
   </annotation>
82

  
83
   <annotation>
84
      <appinfo>
85
         <meta.section type="apiinfo"/>
86
      </appinfo>
87
      <documentation>
88
         [Enter API information here.]
89
      </documentation>
90
   </annotation>
91

  
92
   <annotation>
93
      <appinfo>
94
         <meta.section type="implementation"/>
95
      </appinfo>
96
      <documentation>
97
         [Enter information about supplied implementation of this extension point.]
98
      </documentation>
99
   </annotation>
100

  
101

  
102
</schema>
0 103

  
TXM/trunk/org.txm.treesearch.core/preferences/TreeSearchPreferences.java (revision 3313)
1
package org.txm.tigersearch.rcp.preferences;
2

  
3

  
4
import org.osgi.service.prefs.Preferences;
5
import org.txm.core.preferences.TXMPreferences;
6

  
7
/**
8
 * Preferences initializer and manager.
9
 * 
10
 * @author mdecorde
11
 *
12
 */
13
public class TreeSearchPreferences extends TXMPreferences {
14
	
15
	
16
	public static String VERSION = "version";
17
	
18
	public static String USESUBMATCHES = "use_sub_matches";
19
	
20
	public static String UDPREFIX = "ud_prefix";
21
	
22
	/**
23
	 * Gets the instance.
24
	 * 
25
	 * @return the instance
26
	 */
27
	public static TXMPreferences getInstance() {
28
		if (!TXMPreferences.instances.containsKey(TreeSearchPreferences.class)) {
29
			new TreeSearchPreferences();
30
		}
31
		return TXMPreferences.instances.get(TreeSearchPreferences.class);
32
	}
33
	
34
	
35
	@Override
36
	public void initializeDefaultPreferences() {
37
		super.initializeDefaultPreferences();
38
		
39
		Preferences preferences = this.getDefaultPreferencesNode();
40
		preferences.putBoolean(USESUBMATCHES, true);
41
		preferences.put(UDPREFIX, "ud-");
42
		// preferences.putBoolean(GROUP_BY_TEXTS, true);
43
		// preferences.putInt(METHOD, 2);
44
	}
45
}
46

  
47

  
0 48

  
TXM/trunk/org.txm.treesearch.core/preferences/TreeSearchPreferencePage.java (revision 3313)
1
package org.txm.tigersearch.rcp.preferences;
2

  
3
import org.eclipse.ui.IWorkbench;
4
import org.txm.rcp.IImageKeys;
5
import org.txm.rcp.preferences.TXMPreferencePage;
6
import org.txm.rcp.preferences.TXMPreferenceStore;
7

  
8
/**
9
 * TIGERSearch preference page
10
 * @author mdecorde
11
 *
12
 */
13
public class TreeSearchPreferencePage extends TXMPreferencePage {
14

  
15
	@Override
16
	public void createFieldEditors() {
17
//		this.addField(new ComboFieldEditor(TIGERSearchPreferences.METHOD, "Method", methods, chartsTab));
18
//		this.addField(new BooleanFieldEditor(TIGERSearchPreferences.GROUP_BY_TEXTS, "Group by words", chartsTab));
19
	}
20
	
21
	/*
22
	 * (non-Javadoc)
23
	 * 
24
	 * @see
25
	 * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
26
	 */
27
	@Override
28
	public void init(IWorkbench workbench) {
29
		this.setPreferenceStore(new TXMPreferenceStore(TreeSearchPreferences.getInstance().getPreferencesNodeQualifier()));
30
		this.setDescription("Syntax Tree");
31
		this.setImageDescriptor(IImageKeys.getImageDescriptor(this.getClass(), "icons/functions/Tree.png"));
32
	}
33
}
0 34

  
TXM/trunk/org.txm.treesearch.core/.project (revision 3313)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>org.txm.treesearch.core</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>org.eclipse.pde.ManifestBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
		<buildCommand>
19
			<name>org.eclipse.pde.SchemaBuilder</name>
20
			<arguments>
21
			</arguments>
22
		</buildCommand>
23
	</buildSpec>
24
	<natures>
25
		<nature>org.eclipse.pde.PluginNature</nature>
26
		<nature>org.eclipse.jdt.core.javanature</nature>
27
	</natures>
28
</projectDescription>
0 29

  
TXM/trunk/org.txm.treesearch.core/src/org/txm/treesearch/preferences/TreeSearchPreferences.java (revision 3313)
1
package org.txm.treesearch.preferences;
2

  
3

  
4
import org.osgi.service.prefs.Preferences;
5
import org.txm.core.preferences.TXMPreferences;
6

  
7
/**
8
 * Preferences initializer and manager.
9
 * 
10
 * @author mdecorde
11
 *
12
 */
13
public class TreeSearchPreferences extends TXMPreferences {
14
	
15
	public static final String VERSION = "version";
16
	
17
	public static final String DEFAULT_REPRESENTATION = "default_representation";
18
	
19
	public static final String TFEATURE = "t";
20
	
21
	public static final String NTFEATURE = "nt";
22
	
23
	/**
24
	 * Gets the instance.
25
	 * 
26
	 * @return the instance
27
	 */
28
	public static TXMPreferences getInstance() {
29
		if (!TXMPreferences.instances.containsKey(TreeSearchPreferences.class)) {
30
			new TreeSearchPreferences();
31
		}
32
		return TXMPreferences.instances.get(TreeSearchPreferences.class);
33
	}
34
	
35
	@Override
36
	public void initializeDefaultPreferences() {
37
		super.initializeDefaultPreferences();
38
		
39
		Preferences preferences = this.getDefaultPreferencesNode();
40
		preferences.put(DEFAULT_REPRESENTATION, "TIGER");
41
	}
42
}
0 43

  
TXM/trunk/org.txm.treesearch.core/src/org/txm/treesearch/function/TreeSearch.java (revision 3313)
1
package org.txm.treesearch.function;
2

  
3
import java.io.File;
4

  
5
import org.txm.core.preferences.TXMPreferences;
6
import org.txm.core.results.Parameter;
7
import org.txm.core.results.TXMParameters;
8
import org.txm.core.results.TXMResult;
9
import org.txm.searchengine.core.IQuery;
10
import org.txm.searchengine.cqp.corpus.CQPCorpus;
11
import org.txm.treesearch.preferences.TreeSearchPreferences;
12

  
13
public abstract class TreeSearch extends TXMResult {
14
	
15
	protected CQPCorpus corpus;
16
	
17
	/**
18
	 * from 0 to N-1 sentences
19
	 */
20
	@Parameter(key = TXMPreferences.INDEX)
21
	protected int index;
22
	
23
	/**
24
	 * from 0 to N-1 sentence subgraphs
25
	 */
26
	@Parameter(key = TXMPreferences.SUB_INDEX)
27
	protected int subIndex;
28

  
29
	@Parameter(key = TXMPreferences.QUERY)
30
	protected IQuery pQuery;
31
	
32
	@Parameter(key = TreeSearchPreferences.TFEATURE)
33
	protected String T;
34
	
35
	@Parameter(key = TreeSearchPreferences.NTFEATURE)
36
	protected String NT;
37
	
38

  
39
	public TreeSearch(CQPCorpus corpus) {
40
		
41
		this(null, corpus);
42
	}
43
	
44
	public TreeSearch(String parentNodePath) {
45
		
46
		this(parentNodePath, null);
47
	}
48
	
49
	public TreeSearch(String parentNodePath, CQPCorpus corpus) {
50
		
51
		super(parentNodePath, corpus);
52
	}
53
	
54
	@Override
55
	public boolean canCompute() {
56
		
57
		return corpus != null; // && pQuery != null && pQuery.length() > 0; // if pQuery is empty/null set a default query
58
	}
59
	
60
	public abstract String[] getAvailableNTProperties();
61
	
62
	public abstract String[] getAvailableTProperties();
63
	
64
	public CQPCorpus getCorpus() {
65
		
66
		return corpus;
67
	}
68
	
69
	@Override
70
	public String getDetails() {
71
		
72
		if (pQuery != null) {
73
			return pQuery.toString();
74
		}
75
		return "no query";
76
	}
77
	
78
	@Override
79
	public String getName() {
80
		
81
		if (pQuery != null) {
82
			return pQuery.toString();
83
		}
84
		return "no query";
85
	}
86
	
87
	public abstract int getNSentences();
88
	
89
	public abstract int getNSubGraph(int matchNo);
90
	
91
	public final String getNT() {
92
		return NT;
93
	}
94
	
95
	public abstract String getQuery();
96
	
97
	@Override
98
	public String getSimpleName() {
99
		
100
		if (pQuery != null) {
101
			return pQuery.toString();
102
		}
103
		return "no query";
104
	}
105
	
106
	public abstract int getSub(int matchNo);
107
	
108
	public final String getT() {
109
		return T;
110
	}
111
	
112
	public abstract boolean hasSubMatchesStrategy();
113
	
114
	@Override
115
	public abstract boolean setParameters(TXMParameters parameters);
116
	
117
	public abstract boolean toSVG(File svgFile, int sent, int sub, String T, String NT);
118

  
119
	public abstract boolean isReady();
120

  
121
	public abstract void setIndexAndSubIndex(int sent, int sub);
122

  
123
	public abstract boolean isComputed();
124

  
125
	public abstract boolean isDrawn();
126

  
127
	public abstract String getEngine();
128

  
129
	public abstract TreeSearchSelector getSelector();
130
	
131
	public abstract String[] getTextAndWordIDSOfCurrentSentence() throws Exception;
132
	
133
	public abstract String getIconPath();
134

  
135
	public int getCurrentMatchIndex() {
136
		
137
		return index;
138
	}
139

  
140
	public int getCurrentSubMatchIndex() {
141
		
142
		return this.subIndex;
143
	}
144
	
145
}
0 146

  
TXM/trunk/org.txm.treesearch.core/src/org/txm/treesearch/function/TreeSearchSelector.java (revision 3313)
1
package org.txm.treesearch.function;
2

  
3
import org.txm.searchengine.core.Query;
4
import org.txm.searchengine.cqp.corpus.CQPCorpus;
5

  
6
public abstract class TreeSearchSelector {
7
	
8
	public TreeSearchSelector() {
9
		
10
	}
11
	
12
	public abstract String getEngine();
13
	
14
	public abstract boolean canComputeWith(CQPCorpus corpus);
15

  
16
	public abstract TreeSearch getTreeSearch(CQPCorpus corpus);
17

  
18
	public abstract Class<? extends Query> getQueryClass();
19
}
0 20

  
TXM/trunk/org.txm.treesearch.core/build.properties (revision 3313)
1
source.. = src/
2
output.. = bin/
3
bin.includes = META-INF/,\
4
               .,\
5
               plugin.xml,\
6
               schema/
0 7

  

Formats disponibles : Unified diff