Révision 2415
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/QueryPart.java (revision 2415) | ||
---|---|---|
38 | 38 |
* @author Jean Philippe Magué |
39 | 39 |
* @author sloiseau |
40 | 40 |
*/ |
41 |
<<<<<<< .mine |
|
42 | 41 |
public class QueryPart extends SubcorpusCQLQuery { |
43 | 42 |
|
44 |
||||||| .r2406 |
|
45 |
======= |
|
46 |
public class QueryPart extends CQLQuery { |
|
43 |
String value; |
|
47 | 44 |
|
48 |
/** The structure. */ |
|
49 |
protected StructuralUnit structure; |
|
50 |
|
|
51 |
/** The property. */ |
|
52 |
protected StructuralUnitProperty property; |
|
53 |
|
|
54 |
/** The value. */ |
|
55 |
protected String value; |
|
56 |
|
|
57 |
>>>>>>> .r2411 |
|
58 | 45 |
/** |
59 | 46 |
* Instantiates a new query part. |
60 | 47 |
* |
... | ... | |
62 | 49 |
* @param property the property |
63 | 50 |
* @param value the value, not a regexp |
64 | 51 |
*/ |
65 |
<<<<<<< .mine |
|
52 |
|
|
66 | 53 |
public QueryPart(StructuralUnit structure, StructuralUnitProperty property, String value) { |
67 | 54 |
super(structure, property, CQLQuery.addBackSlash(value)); |
68 |
||||||| .r2406 |
|
69 |
======= |
|
70 |
public QueryPart(StructuralUnit structure, StructuralUnitProperty property, |
|
71 |
String value) { |
|
72 |
this.structure = structure; |
|
73 |
this.property = property; |
|
74 | 55 |
this.value = value; |
75 |
|
|
76 |
// String tag = structure.getName() + TAG_ATTRIBUTE_SEPARATOR + property.getName(); |
|
77 |
// String label = "a"; //$NON-NLS-1$ |
|
78 |
// StringBuffer query = new StringBuffer(); |
|
79 |
// query.append(REGION_MACRO + START_MACRO_ARGS); |
|
80 |
// query.append(tag + MACRO_ARGS_SEPARATOR + label + END_MACRO_ARGS); |
|
81 |
// query.append(START_GLOBAL_CONSTRAINT + label + DOT + tag + EQUALS |
|
82 |
// + START_DOUBLE_QUOTE + value + END_DOUBLE_QUOTE); |
|
83 |
// queryString = query.toString(); |
|
84 |
|
|
85 |
if ("text".equals(structure.getName())) { // optimization only for the text structure |
|
86 |
queryString = "<" + property.getFullName() + "=\"" + CQLQuery.addBackSlash(value) + "\">[] expand to " + structure.getName(); |
|
87 |
} |
|
88 |
else { |
|
89 |
queryString = "[_." + property.getFullName() + "=\"" + CQLQuery.addBackSlash(value) + "\"] expand to " + structure.getName(); |
|
90 |
} |
|
91 |
>>>>>>> .r2411 |
|
92 | 56 |
} |
93 |
<<<<<<< .mine |
|
94 |
||||||| .r2406 |
|
95 |
======= |
|
96 | 57 |
|
97 |
public StructuralUnit getStructure() { |
|
98 |
return structure; |
|
99 |
} |
|
100 |
|
|
101 |
public StructuralUnitProperty getProperty() { |
|
102 |
return property; |
|
103 |
} |
|
104 |
|
|
105 | 58 |
public String getValue() { |
106 | 59 |
return value; |
107 | 60 |
} |
108 |
|
|
109 |
// /* |
|
110 |
// * (non-Javadoc) |
|
111 |
// * |
|
112 |
// * @see org.txm.searchengine.cqp.corpus.query.Query#getQueryString() |
|
113 |
// */ |
|
114 |
// /* |
|
115 |
// * Produce a query such as: [_.struct_property="value"] expand to struct |
|
116 |
// * |
|
117 |
// * OLD VERSION: /region[TEI_type,a]::a.TEI_type="value" |
|
118 |
// */ |
|
119 |
// @Override |
|
120 |
// public String getQueryString() { |
|
121 |
// return queryString; |
|
122 |
// |
|
123 |
// // another way to query parts less restrictif but missleading |
|
124 |
// //return String.format("[_.%s=\"%s\"] expand to %s", tag, value, structure.getName()); |
|
125 |
// } |
|
126 |
>>>>>>> .r2411 |
|
127 | 61 |
} |
Formats disponibles : Unified diff