Skip to content

Commit

Permalink
add error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ofilangi committed Apr 22, 2024
1 parent e9bf6c6 commit 8ba8fb7
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions app/build/pmid_to_identifier_rdf4j.sc
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,41 @@ def main(outfile : String,pc_reference_identifier_files : String*) : Unit = {
val format: RDFFormat = RDFFormat.TURTLE

try {

val res: GraphQueryResult = QueryResults.parseGraphBackground(is, baseURI, format,null)
try {
while (res.hasNext()) {
val st: Statement = res.next()

val objUri = st.getObject().toString()
if (objUri.contains("pubmed.ncbi.nlm.nih.gov") && !objUri.contains("PMC")) {
val sub = st.getSubject().toString().split("/").last.trim
val obj = objUri.split("/").last.trim
fileWriter.write(sub+"\t"+obj+"\n")
}
try {
// println("Hop")
val st: Statement = res.next()

val objUri = st.getObject().toString()
// println(objUri)
if (objUri.contains("pubmed.ncbi.nlm.nih.gov") && !objUri.contains("PMC")) {
val sub = st.getSubject().toString().split("/").last.trim
val obj = objUri.split("/").last.trim
fileWriter.write(sub+"\t"+obj+"\n")
}
//println("fin Hop")
} catch {
case e: Exception =>
// Gérer l'erreur irrécupérable ici
}

}
} catch {
case e: Exception =>
// Gérer l'erreur irrécupérable ici
System.err.println("1:"+e.getMessage())
System.exit(-1)
} finally {
res.close()
}
} catch {
case e: Exception =>
// Gérer l'erreur irrécupérable ici
System.err.println("1:"+e.getMessage())
System.exit(-1)
} finally {
is.close()
}
Expand Down

0 comments on commit 8ba8fb7

Please sign in to comment.