Skip to content

Commit

Permalink
Merge pull request #184 from diging/develop
Browse files Browse the repository at this point in the history
Prepare Release
  • Loading branch information
jdamerow authored Jul 17, 2017
2 parents 51051e3 + a525f23 commit bdbf8db
Show file tree
Hide file tree
Showing 40 changed files with 689 additions and 192 deletions.
1 change: 1 addition & 0 deletions Conceptpower+Spring/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/buildNumber.properties
/.settings/
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/integration-test/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/integration-test/resources"/>
<property name="java-output-path" value="target/classes"/>
<property name="context-root" value="conceptpower"/>
</wb-module>
Expand Down
7 changes: 7 additions & 0 deletions Conceptpower+Spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,13 @@
<artifactId>xmlunit</artifactId>
<version>1.6</version>
</dependency>

<!-- jsoup HTML parser library @ http://jsoup.org/ -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.10.2</version>
</dependency>
</dependencies>

<scm>
Expand Down
Original file line number Diff line number Diff line change
@@ -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}}
{"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}}
Original file line number Diff line number Diff line change
@@ -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}}
{"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}}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ public interface LuceneFieldNames {
public final static String CONCEPTTYPE = "conceptType";
public final static String MERGED_IDS = "mergedIds";
public final static String UNTOKENIZED_SUFFIX = "_untokenized";
public final static String NOT_LOWERCASED = "_notLowercased";
public final static String SORT_SUFFIX = "_sorted";
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ public abstract void addConceptListEntry(String word, String pos, String descrip
*
* @param entry
* the {@link ConceptEntry} to be stored.
* @return Id of stored entry.
* @return ConceptEntry along with the id and alternative id details.
* @throws DictionaryDoesNotExistException
* If the entry has a concept list specified that doesn't exist.
* @throws DictionaryModifyException
* If the specified concept list in the concept is the Wordnet
* list.
*/
public abstract String addConceptListEntry(ConceptEntry entry, String userName)
public abstract ConceptEntry addConceptListEntry(ConceptEntry entry, String userName)
throws DictionaryDoesNotExistException, DictionaryModifyException, LuceneException, IllegalAccessException,
IndexerRunningException;

Expand Down Expand Up @@ -151,19 +151,22 @@ public ConceptEntry getConceptWrappedEntryByWordNetId(String wordNetID)
/**
* This method fetches the concept entry details based on word, pos and
* concept list values. This method also accepts parameters for pagination
* and sorting.
*
* @param word
* @param pos
* @param conceptList
* @param page
* @param numberOfRecordsPerPage
* @param sortField
* @param sortOrder
* @return
* @throws LuceneException
* @throws IllegalAccessException
* @throws IndexerRunningException
*/
public ConceptEntry[] getConceptListEntriesForWordPOS(String word, String pos, String conceptList,
int page, int numberOfRecordsPerPage)
public ConceptEntry[] getConceptListEntriesForWordPOS(String word, String pos, String conceptList, int page,
int numberOfRecordsPerPage, String sortField, int sortOrder)
throws LuceneException, IllegalAccessException, IndexerRunningException;

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

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

public int getPageCountForConceptEntries(String word, String pos, String conceptList)
throws IllegalAccessException, LuceneException, IndexerRunningException;

/**
* This method fetches the original concept entry and not the merged concept
* entry.
*
* @param id
* @return
*/
public ConceptEntry getOriginalConceptEntry(String id);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import edu.asu.conceptpower.app.exceptions.IndexerRunningException;
import edu.asu.conceptpower.app.exceptions.LuceneException;
import edu.asu.conceptpower.app.util.CCPSort;
import edu.asu.conceptpower.core.ConceptEntry;
import edu.asu.conceptpower.core.IndexingEvent;

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

public ConceptEntry[] searchForConceptByPageNumberAndFieldMap(Map<String, String> fieldMap,
String operator, int pageNumber, int numberOfRecordsPerPage)
public ConceptEntry[] searchForConceptByPageNumberAndFieldMap(Map<String, String> fieldMap, String operator,
int pageNumber, int numberOfRecordsPerPage, CCPSort sort)
throws LuceneException, IllegalAccessException, IndexerRunningException;

public int getTotalNumberOfRecordsForSearch(Map<String, String> fieldMap, String operator)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import edu.asu.conceptpower.app.exceptions.DictionaryModifyException;
import edu.asu.conceptpower.app.exceptions.IndexerRunningException;
import edu.asu.conceptpower.app.exceptions.LuceneException;
import edu.asu.conceptpower.app.util.CCPSort;
import edu.asu.conceptpower.app.util.CCPSort.SortOrder;
import edu.asu.conceptpower.app.wordnet.Constants;
import edu.asu.conceptpower.app.wordnet.WordNetManager;
import edu.asu.conceptpower.core.ConceptEntry;
Expand Down Expand Up @@ -124,7 +126,7 @@ public ConceptEntry getWordnetConceptEntry(String wordnetId) throws LuceneExcept
@Override
public ConceptEntry[] getConceptListEntriesForWordPOS(String word, String pos, String conceptList)
throws LuceneException, IllegalAccessException, IndexerRunningException {
return getConceptListEntriesForWordPOS(word, pos, conceptList, -1, -1);
return getConceptListEntriesForWordPOS(word, pos, conceptList, -1, -1, null, 0);
}

/*
Expand All @@ -136,17 +138,29 @@ public ConceptEntry[] getConceptListEntriesForWordPOS(String word, String pos, S
* java.lang.String, java.lang.String)
*/
@Override
public ConceptEntry[] getConceptListEntriesForWordPOS(String word, String pos, String conceptList,
int page, int numberOfRecordsPerPage)
throws LuceneException, IllegalAccessException, IndexerRunningException {
public ConceptEntry[] getConceptListEntriesForWordPOS(String word, String pos, String conceptList, int page,
int numberOfRecordsPerPage, String sortField, int sortOrder)
throws LuceneException, IllegalAccessException, IndexerRunningException {
if (pos == null)
return null;

Map<String, String> fieldMap = new HashMap<String, String>();
fieldMap.put(SearchFieldNames.WORD, word);
fieldMap.put(SearchFieldNames.POS, pos);
fieldMap.put(SearchFieldNames.CONCEPT_LIST, conceptList);
return indexService.searchForConceptByPageNumberAndFieldMap(fieldMap, null, page, numberOfRecordsPerPage);

CCPSort ccpSort = null;
if (sortField != null) {
ccpSort = new CCPSort(sortField, sortOrder == -1 ? SortOrder.DESCENDING : SortOrder.ASCENDING);
}
return indexService.searchForConceptByPageNumberAndFieldMap(fieldMap, null, page, numberOfRecordsPerPage,
ccpSort);
}

@Override
public int getPageCountForConceptEntries(String word, String pos, String conceptList) throws IllegalAccessException, LuceneException, IndexerRunningException {
int totalEntries = getConceptListEntriesForWordPOS(word, pos, conceptList, -1, -1, null, 0).length;
return (int) Math.ceil(new Double(totalEntries) / new Double(defaultPageSize));
}

/**
Expand Down Expand Up @@ -431,7 +445,7 @@ public void addConceptListEntry(String word, String pos, String description, Str
* conceptpower.core.ConceptEntry)
*/
@Override
public String addConceptListEntry(ConceptEntry entry, String userName) throws DictionaryDoesNotExistException,
public ConceptEntry addConceptListEntry(ConceptEntry entry, String userName) throws DictionaryDoesNotExistException,
DictionaryModifyException, LuceneException, IllegalAccessException, IndexerRunningException {
ConceptList dict = client.getConceptList(entry.getConceptList());
if (dict == null)
Expand All @@ -458,7 +472,7 @@ public String addConceptListEntry(ConceptEntry entry, String userName) throws Di

}
indexService.insertConcept(entry, userName);
return id;
return entry;
}


Expand Down Expand Up @@ -584,4 +598,23 @@ public void updateIndex(ConceptEntry entry, String userName)
public void deleteFromIndex(String id, String userName) throws LuceneException, IndexerRunningException {
indexService.deleteById(id, userName);
}

@Override
public ConceptEntry getOriginalConceptEntry(String id) {

ConceptEntry entry = wordnetManager.getConcept(id);
if (entry != null) {
fillConceptEntry(entry);
alternativeIdService.addAlternativeIds(id, entry);
return entry;
}

entry = client.getEntry(id);
if (entry != null) {
alternativeIdService.addAlternativeIds(id, entry);
return entry;
}

return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import edu.asu.conceptpower.app.exceptions.LuceneException;
import edu.asu.conceptpower.app.lucene.ILuceneDAO;
import edu.asu.conceptpower.app.lucene.ILuceneUtility;
import edu.asu.conceptpower.app.util.CCPSort;
import edu.asu.conceptpower.core.ConceptEntry;
import edu.asu.conceptpower.core.IndexingEvent;

Expand Down Expand Up @@ -59,7 +60,7 @@ public ConceptEntry[] searchForConcepts(Map<String, String> fieldMap, String ope
throw new IndexerRunningException(indexerRunning);
}
// Fetches all the pages
return luceneUtility.queryIndex(fieldMap, operator, 0, -1);
return luceneUtility.queryIndex(fieldMap, operator, 0, -1, null);
}

/**
Expand All @@ -68,14 +69,14 @@ public ConceptEntry[] searchForConcepts(Map<String, String> fieldMap, String ope
*/
@Override
public ConceptEntry[] searchForConceptByPageNumberAndFieldMap(Map<String, String> fieldMap, String operator,
int pageNumber, int numberOfRecordsPerPage)
int pageNumber, int numberOfRecordsPerPage, CCPSort sort)
throws LuceneException, IllegalAccessException, IndexerRunningException {

if (indexerRunningFlag.get()) {
throw new IndexerRunningException(indexerRunning);
}

ConceptEntry[] entries = luceneUtility.queryIndex(fieldMap, operator, pageNumber, numberOfRecordsPerPage);
ConceptEntry[] entries = luceneUtility.queryIndex(fieldMap, operator, pageNumber, numberOfRecordsPerPage, sort);
alternativeIdService.addAlternativeIds(entries);
return entries;
}
Expand Down
Loading

0 comments on commit bdbf8db

Please sign in to comment.