Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Raphael
histream
Commits
5a0e07a1
Commit
5a0e07a1
authored
Jul 28, 2015
by
R.W.Majeed
Browse files
allow specification of scheme for i2b2 ontology
parent
1fafc9d4
Changes
2
Show whitespace changes
Inline
Side-by-side
HIStream-SKOS/src/main/java/de/sekmi/histream/ontology/skos/Store.java
View file @
5a0e07a1
...
...
@@ -194,7 +194,11 @@ public class Store implements Ontology, Plugin {
@Override
public
Concept
[]
getTopConcepts
(
String
scheme
)
throws
OntologyException
{
return
getRelatedConcepts
(
repo
.
getValueFactory
().
createURI
(
scheme
),
SKOS
.
HAS_TOP_CONCEPT
);
URI
schemeURI
=
null
;
if
(
scheme
!=
null
){
schemeURI
=
repo
.
getValueFactory
().
createURI
(
scheme
);
}
return
getRelatedConcepts
(
schemeURI
,
SKOS
.
HAS_TOP_CONCEPT
);
}
private
Concept
[]
getRelatedConcepts
(
Resource
subject
,
URI
predicate
)
throws
OntologyException
{
RepositoryResult
<
Statement
>
rr
;
...
...
HIStream-i2b2/src/main/java/de/sekmi/histream/i2b2/ont/Import.java
View file @
5a0e07a1
...
...
@@ -52,6 +52,7 @@ public class Import implements AutoCloseable{
private
int
insertConceptCount
;
private
String
sourceId
;
private
String
scheme
;
private
Timestamp
sourceTimestamp
;
/**
...
...
@@ -65,7 +66,8 @@ public class Import implements AutoCloseable{
* Use {@code meta.sourcesystem_cd} for the source system.
* {@code jdbc.host}, {@code jdbc.port}, {@code jdbc.database} are used to construct the connect string.
* Any other parameters starting with {@code jdbc.} are also passed to {@link DriverManager#getConnection(String, Properties)}.
*
* <p>
* More parameters: {@code ont.language} and {@code ont.scheme}.
* @throws ClassNotFoundException
* @throws SQLException
*/
...
...
@@ -121,6 +123,10 @@ public class Import implements AutoCloseable{
}
else
{
locale
=
Locale
.
forLanguageTag
(
config
.
get
(
"ont.language"
));
}
// parse scheme
if
(
config
.
get
(
"ont.language"
)
!=
null
){
this
.
scheme
=
config
.
get
(
"ont.scheme"
);
}
// parse base path
String
base
=
config
.
get
(
"meta.basepath"
);
...
...
@@ -135,7 +141,9 @@ public class Import implements AutoCloseable{
base_level
=
0
;
}
Concept
[]
concepts
=
ontology
.
getTopConcepts
();
Concept
[]
concepts
=
ontology
.
getTopConcepts
(
this
.
scheme
);
for
(
Concept
c
:
concepts
){
insertMeta
(
base_level
,
base
,
c
,
true
);
}
...
...
@@ -248,13 +256,18 @@ public class Import implements AutoCloseable{
if
(
label
==
null
){
// no label for language, try to get neutral label
label
=
concept
.
getPrefLabel
(
null
);
path_part
=
label
;
if
(
label
==
null
){
// concept does not have a label
path_part
=
Integer
.
toHexString
(
concept
.
hashCode
());
label
=
concept
.
toString
();
path_part
=
label
;
//Integer.toHexString(concept.hashCode());
log
.
warning
(
"Missing prefLabel for concept "
+
concept
+
" substituted with hashCode:"
+
label
);
}
}
// TODO find better way to generate path_part
path_part
=
Integer
.
toHexString
(
label
.
hashCode
());
// use hashcode
String
path
=
path_prefix
+
path_part
+
"\\"
;
insertMeta
.
setString
(
2
,
path
);
insertMeta
.
setString
(
3
,
label
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment