Skip to content

Commit bdbf8db

Browse files
authored
Merge pull request #184 from diging/develop
Prepare Release
2 parents 51051e3 + a525f23 commit bdbf8db

40 files changed

Lines changed: 689 additions & 192 deletions

Conceptpower+Spring/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/buildNumber.properties
2+
/.settings/

Conceptpower+Spring/.settings/org.eclipse.wst.common.component

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
55
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
66
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
7-
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/integration-test/java"/>
8-
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/integration-test/resources"/>
97
<property name="java-output-path" value="target/classes"/>
108
<property name="context-root" value="conceptpower"/>
119
</wb-module>

Conceptpower+Spring/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,13 @@
559559
<artifactId>xmlunit</artifactId>
560560
<version>1.6</version>
561561
</dependency>
562+
563+
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
564+
<dependency>
565+
<groupId>org.jsoup</groupId>
566+
<artifactId>jsoup</artifactId>
567+
<version>1.10.2</version>
568+
</dependency>
562569
</dependencies>
563570

564571
<scm>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"conceptEntries":[{"id":"WID-10954498-N-01-Einstein","lemma":"einstein","pos":"noun","description":"physicist born in Germany who formulated the special theory of relativity and the general theory of relativity; Einstein also proposed that light consists of discrete quantized bundles of energy (later called photons) (1879-1955)","conceptList":"WordNet","deleted":false,"alternativeIds":[{"concept_id":"WID-10954498-N-01-Einstein","concept_uri":"http://www.digitalhps.org/concepts/WID-10954498-N-01-Einstein"}],"concept_uri":"http://www.digitalhps.org/concepts/WID-10954498-N-01-Einstein","creator_id":"","equal_to":"","modified_by":"","similar_to":"","synonym_ids":"WID-10954498-N-02-Albert_Einstein,","wordnet_id":"WID-10954498-N-01-Einstein"},{"id":"WID-10126926-N-05-Einstein","lemma":"einstein","pos":"noun","description":"someone who has exceptional intellectual ability and originality; \"Mozart was a child genius\"; \"he's smart but he's no Einstein\"","conceptList":"WordNet","deleted":false,"alternativeIds":[{"concept_id":"WID-10126926-N-05-Einstein","concept_uri":"http://www.digitalhps.org/concepts/WID-10126926-N-05-Einstein"}],"concept_uri":"http://www.digitalhps.org/concepts/WID-10126926-N-05-Einstein","creator_id":"","equal_to":"","modified_by":"","similar_to":"","synonym_ids":"WID-10126926-N-01-genius,WID-10126926-N-02-mastermind,WID-10126926-N-03-brain,WID-10126926-N-04-brainiac,","wordnet_id":"WID-10126926-N-05-Einstein"},{"id":"WID-10954498-N-02-Albert_Einstein","lemma":"albert einstein","pos":"noun","description":"physicist born in Germany who formulated the special theory of relativity and the general theory of relativity; Einstein also proposed that light consists of discrete quantized bundles of energy (later called photons) (1879-1955)","conceptList":"WordNet","deleted":false,"alternativeIds":[{"concept_id":"WID-10954498-N-02-Albert_Einstein","concept_uri":"http://www.digitalhps.org/concepts/WID-10954498-N-02-Albert_Einstein"}],"concept_uri":"http://www.digitalhps.org/concepts/WID-10954498-N-02-Albert_Einstein","creator_id":"","equal_to":"","modified_by":"","similar_to":"","synonym_ids":"WID-10954498-N-01-Einstein,","wordnet_id":"WID-10954498-N-02-Albert_Einstein"},{"id":"WID-05875723-N-01-Bose-Einstein_statistics","lemma":"bose-einstein statistics","pos":"noun","description":"(physics) statistical law obeyed by a system of particles whose wave function is not changed when two particles are interchanged (the Pauli exclusion principle does not apply)","conceptList":"WordNet","deleted":false,"alternativeIds":[{"concept_id":"WID-05875723-N-01-Bose-Einstein_statistics","concept_uri":"http://www.digitalhps.org/concepts/WID-05875723-N-01-Bose-Einstein_statistics"}],"concept_uri":"http://www.digitalhps.org/concepts/WID-05875723-N-01-Bose-Einstein_statistics","creator_id":"","equal_to":"","modified_by":"","similar_to":"","synonym_ids":"","wordnet_id":"WID-05875723-N-01-Bose-Einstein_statistics"}],"pagination":{"pageNumber":1,"totalNumberOfRecords":4}}
1+
{"conceptEntries":[{"id":"WID-10954498-N-01-Einstein","lemma":"einstein","pos":"noun","description":"physicist born in Germany who formulated the special theory of relativity and the general theory of relativity; Einstein also proposed that light consists of discrete quantized bundles of energy (later called photons) (1879-1955)","conceptList":"WordNet","deleted":false,"concept_uri":"http://www.digitalhps.org/concepts/WID-10954498-N-01-Einstein","creator_id":"","equal_to":"","modified_by":"","similar_to":"","synonym_ids":"WID-10954498-N-02-Albert_Einstein,","wordnet_id":"WID-10954498-N-01-Einstein","alternativeIds":[{"concept_id":"WID-10954498-N-01-Einstein","concept_uri":"http://www.digitalhps.org/concepts/WID-10954498-N-01-Einstein"}]},{"id":"WID-10126926-N-05-Einstein","lemma":"einstein","pos":"noun","description":"someone who has exceptional intellectual ability and originality; \\\"Mozart was a child genius\\\"; \\\"he's smart but he's no Einstein\\\"","conceptList":"WordNet","deleted":false,"concept_uri":"http://www.digitalhps.org/concepts/WID-10126926-N-05-Einstein","creator_id":"","equal_to":"","modified_by":"","similar_to":"","synonym_ids":"WID-10126926-N-01-genius,WID-10126926-N-02-mastermind,WID-10126926-N-03-brain,WID-10126926-N-04-brainiac,","wordnet_id":"WID-10126926-N-05-Einstein","alternativeIds":[{"concept_id":"WID-10126926-N-05-Einstein","concept_uri":"http://www.digitalhps.org/concepts/WID-10126926-N-05-Einstein"}]},{"id":"WID-10954498-N-02-Albert_Einstein","lemma":"albert einstein","pos":"noun","description":"physicist born in Germany who formulated the special theory of relativity and the general theory of relativity; Einstein also proposed that light consists of discrete quantized bundles of energy (later called photons) (1879-1955)","conceptList":"WordNet","deleted":false,"concept_uri":"http://www.digitalhps.org/concepts/WID-10954498-N-02-Albert_Einstein","creator_id":"","equal_to":"","modified_by":"","similar_to":"","synonym_ids":"WID-10954498-N-01-Einstein,","wordnet_id":"WID-10954498-N-02-Albert_Einstein","alternativeIds":[{"concept_id":"WID-10954498-N-02-Albert_Einstein","concept_uri":"http://www.digitalhps.org/concepts/WID-10954498-N-02-Albert_Einstein"}]},{"id":"WID-05875723-N-01-Bose-Einstein_statistics","lemma":"bose-einstein statistics","pos":"noun","description":"(physics) statistical law obeyed by a system of particles whose wave function is not changed when two particles are interchanged (the Pauli exclusion principle does not apply)","conceptList":"WordNet","deleted":false,"concept_uri":"http://www.digitalhps.org/concepts/WID-05875723-N-01-Bose-Einstein_statistics","creator_id":"","equal_to":"","modified_by":"","similar_to":"","synonym_ids":"","wordnet_id":"WID-05875723-N-01-Bose-Einstein_statistics","alternativeIds":[{"concept_id":"WID-05875723-N-01-Bose-Einstein_statistics","concept_uri":"http://www.digitalhps.org/concepts/WID-05875723-N-01-Bose-Einstein_statistics"}]}],"pagination":{"pageNumber":1,"totalNumberOfRecords":4}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"conceptEntries":[{"id":"WID-10954498-N-01-Einstein","lemma":"einstein","pos":"noun","description":"physicist born in Germany who formulated the special theory of relativity and the general theory of relativity; Einstein also proposed that light consists of discrete quantized bundles of energy (later called photons) (1879-1955)","conceptList":"WordNet","deleted":false,"alternativeIds":[{"concept_id":"WID-10954498-N-01-Einstein","concept_uri":"http://www.digitalhps.org/concepts/WID-10954498-N-01-Einstein"}],"concept_uri":"http://www.digitalhps.org/concepts/WID-10954498-N-01-Einstein","creator_id":"","equal_to":"","modified_by":"","similar_to":"","synonym_ids":"WID-10954498-N-02-Albert_Einstein,","wordnet_id":"WID-10954498-N-01-Einstein"},{"id":"WID-10126926-N-05-Einstein","lemma":"einstein","pos":"noun","description":"someone who has exceptional intellectual ability and originality; \"Mozart was a child genius\"; \"he's smart but he's no Einstein\"","conceptList":"WordNet","deleted":false,"alternativeIds":[{"concept_id":"WID-10126926-N-05-Einstein","concept_uri":"http://www.digitalhps.org/concepts/WID-10126926-N-05-Einstein"}],"concept_uri":"http://www.digitalhps.org/concepts/WID-10126926-N-05-Einstein","creator_id":"","equal_to":"","modified_by":"","similar_to":"","synonym_ids":"WID-10126926-N-01-genius,WID-10126926-N-02-mastermind,WID-10126926-N-03-brain,WID-10126926-N-04-brainiac,","wordnet_id":"WID-10126926-N-05-Einstein"}],"pagination":{"pageNumber":1,"totalNumberOfRecords":4}}
1+
{"conceptEntries":[{"id":"WID-10954498-N-01-Einstein","lemma":"einstein","pos":"noun","description":"physicist born in Germany who formulated the special theory of relativity and the general theory of relativity; Einstein also proposed that light consists of discrete quantized bundles of energy (later called photons) (1879-1955)","conceptList":"WordNet","deleted":false,"concept_uri":"http://www.digitalhps.org/concepts/WID-10954498-N-01-Einstein","creator_id":"","equal_to":"","modified_by":"","similar_to":"","synonym_ids":"WID-10954498-N-02-Albert_Einstein,","wordnet_id":"WID-10954498-N-01-Einstein","alternativeIds":[{"concept_id":"WID-10954498-N-01-Einstein","concept_uri":"http://www.digitalhps.org/concepts/WID-10954498-N-01-Einstein"}]},{"id":"WID-10126926-N-05-Einstein","lemma":"einstein","pos":"noun","description":"someone who has exceptional intellectual ability and originality; \\\"Mozart was a child genius\\\"; \\\"he's smart but he's no Einstein\\\"","conceptList":"WordNet","deleted":false,"concept_uri":"http://www.digitalhps.org/concepts/WID-10126926-N-05-Einstein","creator_id":"","equal_to":"","modified_by":"","similar_to":"","synonym_ids":"WID-10126926-N-01-genius,WID-10126926-N-02-mastermind,WID-10126926-N-03-brain,WID-10126926-N-04-brainiac,","wordnet_id":"WID-10126926-N-05-Einstein","alternativeIds":[{"concept_id":"WID-10126926-N-05-Einstein","concept_uri":"http://www.digitalhps.org/concepts/WID-10126926-N-05-Einstein"}]}],"pagination":{"pageNumber":1,"totalNumberOfRecords":4}}

Conceptpower+Spring/src/main/java/edu/asu/conceptpower/app/constants/LuceneFieldNames.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ public interface LuceneFieldNames {
1717
public final static String CONCEPTTYPE = "conceptType";
1818
public final static String MERGED_IDS = "mergedIds";
1919
public final static String UNTOKENIZED_SUFFIX = "_untokenized";
20+
public final static String NOT_LOWERCASED = "_notLowercased";
21+
public final static String SORT_SUFFIX = "_sorted";
2022
}

Conceptpower+Spring/src/main/java/edu/asu/conceptpower/app/core/IConceptManager.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ public abstract void addConceptListEntry(String word, String pos, String descrip
107107
*
108108
* @param entry
109109
* the {@link ConceptEntry} to be stored.
110-
* @return Id of stored entry.
110+
* @return ConceptEntry along with the id and alternative id details.
111111
* @throws DictionaryDoesNotExistException
112112
* If the entry has a concept list specified that doesn't exist.
113113
* @throws DictionaryModifyException
114114
* If the specified concept list in the concept is the Wordnet
115115
* list.
116116
*/
117-
public abstract String addConceptListEntry(ConceptEntry entry, String userName)
117+
public abstract ConceptEntry addConceptListEntry(ConceptEntry entry, String userName)
118118
throws DictionaryDoesNotExistException, DictionaryModifyException, LuceneException, IllegalAccessException,
119119
IndexerRunningException;
120120

@@ -151,19 +151,22 @@ public ConceptEntry getConceptWrappedEntryByWordNetId(String wordNetID)
151151
/**
152152
* This method fetches the concept entry details based on word, pos and
153153
* concept list values. This method also accepts parameters for pagination
154+
* and sorting.
154155
*
155156
* @param word
156157
* @param pos
157158
* @param conceptList
158159
* @param page
159160
* @param numberOfRecordsPerPage
161+
* @param sortField
162+
* @param sortOrder
160163
* @return
161164
* @throws LuceneException
162165
* @throws IllegalAccessException
163166
* @throws IndexerRunningException
164167
*/
165-
public ConceptEntry[] getConceptListEntriesForWordPOS(String word, String pos, String conceptList,
166-
int page, int numberOfRecordsPerPage)
168+
public ConceptEntry[] getConceptListEntriesForWordPOS(String word, String pos, String conceptList, int page,
169+
int numberOfRecordsPerPage, String sortField, int sortOrder)
167170
throws LuceneException, IllegalAccessException, IndexerRunningException;
168171

169172
/**
@@ -182,4 +185,15 @@ public void updateIndex(ConceptEntry entry, String userName)
182185

183186
public void deleteFromIndex(String id, String userName) throws LuceneException, IndexerRunningException;
184187

188+
public int getPageCountForConceptEntries(String word, String pos, String conceptList)
189+
throws IllegalAccessException, LuceneException, IndexerRunningException;
190+
191+
/**
192+
* This method fetches the original concept entry and not the merged concept
193+
* entry.
194+
*
195+
* @param id
196+
* @return
197+
*/
198+
public ConceptEntry getOriginalConceptEntry(String id);
185199
}

Conceptpower+Spring/src/main/java/edu/asu/conceptpower/app/core/IIndexService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import edu.asu.conceptpower.app.exceptions.IndexerRunningException;
66
import edu.asu.conceptpower.app.exceptions.LuceneException;
7+
import edu.asu.conceptpower.app.util.CCPSort;
78
import edu.asu.conceptpower.core.ConceptEntry;
89
import edu.asu.conceptpower.core.IndexingEvent;
910

@@ -29,8 +30,8 @@ public void indexConcepts(String userName)
2930
public void updateConceptEntry(ConceptEntry entry, String userName)
3031
throws LuceneException, IndexerRunningException, IllegalAccessException;
3132

32-
public ConceptEntry[] searchForConceptByPageNumberAndFieldMap(Map<String, String> fieldMap,
33-
String operator, int pageNumber, int numberOfRecordsPerPage)
33+
public ConceptEntry[] searchForConceptByPageNumberAndFieldMap(Map<String, String> fieldMap, String operator,
34+
int pageNumber, int numberOfRecordsPerPage, CCPSort sort)
3435
throws LuceneException, IllegalAccessException, IndexerRunningException;
3536

3637
public int getTotalNumberOfRecordsForSearch(Map<String, String> fieldMap, String operator)

Conceptpower+Spring/src/main/java/edu/asu/conceptpower/app/core/impl/ConceptManager.java

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
import edu.asu.conceptpower.app.exceptions.DictionaryModifyException;
2626
import edu.asu.conceptpower.app.exceptions.IndexerRunningException;
2727
import edu.asu.conceptpower.app.exceptions.LuceneException;
28+
import edu.asu.conceptpower.app.util.CCPSort;
29+
import edu.asu.conceptpower.app.util.CCPSort.SortOrder;
2830
import edu.asu.conceptpower.app.wordnet.Constants;
2931
import edu.asu.conceptpower.app.wordnet.WordNetManager;
3032
import edu.asu.conceptpower.core.ConceptEntry;
@@ -124,7 +126,7 @@ public ConceptEntry getWordnetConceptEntry(String wordnetId) throws LuceneExcept
124126
@Override
125127
public ConceptEntry[] getConceptListEntriesForWordPOS(String word, String pos, String conceptList)
126128
throws LuceneException, IllegalAccessException, IndexerRunningException {
127-
return getConceptListEntriesForWordPOS(word, pos, conceptList, -1, -1);
129+
return getConceptListEntriesForWordPOS(word, pos, conceptList, -1, -1, null, 0);
128130
}
129131

130132
/*
@@ -136,17 +138,29 @@ public ConceptEntry[] getConceptListEntriesForWordPOS(String word, String pos, S
136138
* java.lang.String, java.lang.String)
137139
*/
138140
@Override
139-
public ConceptEntry[] getConceptListEntriesForWordPOS(String word, String pos, String conceptList,
140-
int page, int numberOfRecordsPerPage)
141-
throws LuceneException, IllegalAccessException, IndexerRunningException {
141+
public ConceptEntry[] getConceptListEntriesForWordPOS(String word, String pos, String conceptList, int page,
142+
int numberOfRecordsPerPage, String sortField, int sortOrder)
143+
throws LuceneException, IllegalAccessException, IndexerRunningException {
142144
if (pos == null)
143145
return null;
144146

145147
Map<String, String> fieldMap = new HashMap<String, String>();
146148
fieldMap.put(SearchFieldNames.WORD, word);
147149
fieldMap.put(SearchFieldNames.POS, pos);
148150
fieldMap.put(SearchFieldNames.CONCEPT_LIST, conceptList);
149-
return indexService.searchForConceptByPageNumberAndFieldMap(fieldMap, null, page, numberOfRecordsPerPage);
151+
152+
CCPSort ccpSort = null;
153+
if (sortField != null) {
154+
ccpSort = new CCPSort(sortField, sortOrder == -1 ? SortOrder.DESCENDING : SortOrder.ASCENDING);
155+
}
156+
return indexService.searchForConceptByPageNumberAndFieldMap(fieldMap, null, page, numberOfRecordsPerPage,
157+
ccpSort);
158+
}
159+
160+
@Override
161+
public int getPageCountForConceptEntries(String word, String pos, String conceptList) throws IllegalAccessException, LuceneException, IndexerRunningException {
162+
int totalEntries = getConceptListEntriesForWordPOS(word, pos, conceptList, -1, -1, null, 0).length;
163+
return (int) Math.ceil(new Double(totalEntries) / new Double(defaultPageSize));
150164
}
151165

152166
/**
@@ -431,7 +445,7 @@ public void addConceptListEntry(String word, String pos, String description, Str
431445
* conceptpower.core.ConceptEntry)
432446
*/
433447
@Override
434-
public String addConceptListEntry(ConceptEntry entry, String userName) throws DictionaryDoesNotExistException,
448+
public ConceptEntry addConceptListEntry(ConceptEntry entry, String userName) throws DictionaryDoesNotExistException,
435449
DictionaryModifyException, LuceneException, IllegalAccessException, IndexerRunningException {
436450
ConceptList dict = client.getConceptList(entry.getConceptList());
437451
if (dict == null)
@@ -458,7 +472,7 @@ public String addConceptListEntry(ConceptEntry entry, String userName) throws Di
458472

459473
}
460474
indexService.insertConcept(entry, userName);
461-
return id;
475+
return entry;
462476
}
463477

464478

@@ -584,4 +598,23 @@ public void updateIndex(ConceptEntry entry, String userName)
584598
public void deleteFromIndex(String id, String userName) throws LuceneException, IndexerRunningException {
585599
indexService.deleteById(id, userName);
586600
}
601+
602+
@Override
603+
public ConceptEntry getOriginalConceptEntry(String id) {
604+
605+
ConceptEntry entry = wordnetManager.getConcept(id);
606+
if (entry != null) {
607+
fillConceptEntry(entry);
608+
alternativeIdService.addAlternativeIds(id, entry);
609+
return entry;
610+
}
611+
612+
entry = client.getEntry(id);
613+
if (entry != null) {
614+
alternativeIdService.addAlternativeIds(id, entry);
615+
return entry;
616+
}
617+
618+
return null;
619+
}
587620
}

Conceptpower+Spring/src/main/java/edu/asu/conceptpower/app/core/impl/IndexService.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import edu.asu.conceptpower.app.exceptions.LuceneException;
1616
import edu.asu.conceptpower.app.lucene.ILuceneDAO;
1717
import edu.asu.conceptpower.app.lucene.ILuceneUtility;
18+
import edu.asu.conceptpower.app.util.CCPSort;
1819
import edu.asu.conceptpower.core.ConceptEntry;
1920
import edu.asu.conceptpower.core.IndexingEvent;
2021

@@ -59,7 +60,7 @@ public ConceptEntry[] searchForConcepts(Map<String, String> fieldMap, String ope
5960
throw new IndexerRunningException(indexerRunning);
6061
}
6162
// Fetches all the pages
62-
return luceneUtility.queryIndex(fieldMap, operator, 0, -1);
63+
return luceneUtility.queryIndex(fieldMap, operator, 0, -1, null);
6364
}
6465

6566
/**
@@ -68,14 +69,14 @@ public ConceptEntry[] searchForConcepts(Map<String, String> fieldMap, String ope
6869
*/
6970
@Override
7071
public ConceptEntry[] searchForConceptByPageNumberAndFieldMap(Map<String, String> fieldMap, String operator,
71-
int pageNumber, int numberOfRecordsPerPage)
72+
int pageNumber, int numberOfRecordsPerPage, CCPSort sort)
7273
throws LuceneException, IllegalAccessException, IndexerRunningException {
7374

7475
if (indexerRunningFlag.get()) {
7576
throw new IndexerRunningException(indexerRunning);
7677
}
7778

78-
ConceptEntry[] entries = luceneUtility.queryIndex(fieldMap, operator, pageNumber, numberOfRecordsPerPage);
79+
ConceptEntry[] entries = luceneUtility.queryIndex(fieldMap, operator, pageNumber, numberOfRecordsPerPage, sort);
7980
alternativeIdService.addAlternativeIds(entries);
8081
return entries;
8182
}

0 commit comments

Comments
 (0)