public class ConceptDaoImpl extends java.lang.Object implements ConceptDao
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
CONCEPT_GRAPH_PATH |
private static java.lang.String |
DEFAULT_ROOT_ID
the default concept id for the root.
|
private static java.lang.String[] |
defaultForbiddenConceptArr
ignore forbidden concepts.
|
private static java.util.Set<java.lang.String> |
defaultForbiddenConcepts |
private IntrinsicInfoContentEvaluator |
intrinsicInfoContentEvaluator |
private JdbcTemplate |
jdbcTemplate |
private static Log |
log |
private SessionFactory |
sessionFactory |
private java.util.Properties |
ytexProperties |
Constructor and Description |
---|
ConceptDaoImpl() |
Modifier and Type | Method and Description |
---|---|
private void |
addRelation(ConceptGraph cg,
java.util.Set<java.lang.String> roots,
java.lang.String childCUI,
java.lang.String parentCUI,
boolean checkCycle,
java.util.Set<java.lang.String> forbiddenConcepts)
add the relationship to the concept map
|
private boolean |
checkCycle(ConcRel crPar,
ConcRel crChild) |
void |
createConceptGraph(java.lang.String dir,
java.lang.String name,
java.lang.String query,
boolean checkCycle,
java.util.Set<java.lang.String> forbiddenConcepts)
create the concept graph with specified name using specified query.
|
ConceptGraph |
getConceptGraph(java.lang.String name)
retrieve an existing concept graph.
|
javax.sql.DataSource |
getDataSource(javax.sql.DataSource ds) |
java.lang.String |
getDefaultConceptGraphDir()
use value of org.apache.ctakes.ytex.conceptGraphDir if defined.
|
IntrinsicInfoContentEvaluator |
getIntrinsicInfoContentEvaluator() |
SessionFactory |
getSessionFactory() |
java.util.Properties |
getYtexProperties() |
private boolean |
hasAncestor(ConcRel crPar,
ConcRel crChild,
java.util.HashSet<java.lang.Integer> visitedNodes)
check cycle.
|
private ConceptGraph |
initializeConceptGraph(ConceptGraph cg)
replace cui strings in concrel with references to other nodes.
|
static void |
main(java.lang.String[] args)
create a concept graph.
|
private static void |
printHelp(Options options) |
private ConceptGraph |
readConceptGraph(java.lang.String name) |
void |
setDataSource(javax.sql.DataSource ds) |
void |
setIntrinsicInfoContentEvaluator(IntrinsicInfoContentEvaluator intrinsicInfoContentEvaluator) |
void |
setSessionFactory(SessionFactory sessionFactory) |
void |
setYtexProperties(java.util.Properties ytexProperties) |
private java.io.File |
urlToFile(java.net.URL url) |
private void |
writeConceptGraph(java.lang.String dir,
java.lang.String name,
ConceptGraph cg)
write the concept graph, create parent directories as required
|
private static final java.lang.String CONCEPT_GRAPH_PATH
private static final java.lang.String DEFAULT_ROOT_ID
private static final java.lang.String[] defaultForbiddenConceptArr
private static java.util.Set<java.lang.String> defaultForbiddenConcepts
private static final Log log
private IntrinsicInfoContentEvaluator intrinsicInfoContentEvaluator
private JdbcTemplate jdbcTemplate
private SessionFactory sessionFactory
private java.util.Properties ytexProperties
public static void main(java.lang.String[] args) throws ParseException, java.io.IOException
args
- ParseException
java.io.IOException
private static void printHelp(Options options)
private void addRelation(ConceptGraph cg, java.util.Set<java.lang.String> roots, java.lang.String childCUI, java.lang.String parentCUI, boolean checkCycle, java.util.Set<java.lang.String> forbiddenConcepts)
conceptMap
- conceptIndexMap
- conceptList
- roots
- conceptPair
- public void createConceptGraph(java.lang.String dir, java.lang.String name, java.lang.String query, boolean checkCycle, java.util.Set<java.lang.String> forbiddenConcepts) throws java.io.IOException
ConceptDao
createConceptGraph
in interface ConceptDao
dir
- directory of concept graph (optional). If null will use
directory specified by the system property/ytex property
org.apache.ctakes.ytex.conceptGraphDir. If the property is not
defined, use [directory of ytex.properties]/conceptGraphname
- name of concept graphquery
- returns 2 string columns, 1st column is the child concept, 2nd
column is the parent concept.checkCycle
- if true will check for cycles and remove them (default true).
If this is set to false, then only pagerank can be used on
this graph.forbiddenConcepts
- set of concepts whose edges will not be added to the concept
graph (optional). By default, this includes umls concepts like
C1274012 (Ambiguous concept).java.io.IOException
public ConceptGraph getConceptGraph(java.lang.String name)
ConceptDao
getConceptGraph
in interface ConceptDao
name
- name of concept graph. Will retrieve from classpath/file
system. @see #createConceptGraphprivate java.io.File urlToFile(java.net.URL url)
public java.lang.String getDefaultConceptGraphDir()
public javax.sql.DataSource getDataSource(javax.sql.DataSource ds)
public IntrinsicInfoContentEvaluator getIntrinsicInfoContentEvaluator()
public SessionFactory getSessionFactory()
public java.util.Properties getYtexProperties()
private boolean hasAncestor(ConcRel crPar, ConcRel crChild, java.util.HashSet<java.lang.Integer> visitedNodes)
crPar
- parentcrChild
- child that should not be an ancestor of parentvisitedNodes
- nodes we've visited in our search. keep track of this to avoid
visiting the same node multiple timesprivate ConceptGraph initializeConceptGraph(ConceptGraph cg)
cg
- private ConceptGraph readConceptGraph(java.lang.String name)
public void setDataSource(javax.sql.DataSource ds)
public void setIntrinsicInfoContentEvaluator(IntrinsicInfoContentEvaluator intrinsicInfoContentEvaluator)
public void setSessionFactory(SessionFactory sessionFactory)
public void setYtexProperties(java.util.Properties ytexProperties)
private void writeConceptGraph(java.lang.String dir, java.lang.String name, ConceptGraph cg)
name
- cg
-