Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Alignment API
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
moex
Alignment API
Commits
32fee72f
Commit
32fee72f
authored
13 years ago
by
Jérôme Euzenat
Browse files
Options
Downloads
Patches
Plain Diff
- improved error handling (report earlier)
parent
2c8ad951
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/fr/inrialpes/exmo/align/cli/GroupAlign.java
+76
-74
76 additions, 74 deletions
src/fr/inrialpes/exmo/align/cli/GroupAlign.java
with
76 additions
and
74 deletions
src/fr/inrialpes/exmo/align/cli/GroupAlign.java
+
76
−
74
View file @
32fee72f
...
...
@@ -3,7 +3,7 @@
*
* Copyright (C) 2003 The University of Manchester
* Copyright (C) 2003 The University of Karlsruhe
* Copyright (C) 2003-2008, 2010-201
1
, INRIA
* Copyright (C) 2003-2008, 2010-201
2
, INRIA
* Copyright (C) 2004, Universit de Montral
*
* Modifications to the initial code base are copyright of their
...
...
@@ -231,23 +231,18 @@ public class GroupAlign {
int
size
=
subdir
.
length
;
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
if
(
subdir
[
i
].
isDirectory
()
)
{
try
{
// Align
if
(
debug
>
0
)
System
.
err
.
println
(
"Directory: "
+
subdir
[
i
]);
align
(
subdir
[
i
]
);
// Unload the ontologies
OntologyFactory
.
clear
();
}
catch
(
Exception
e
)
{
if
(
debug
>
1
)
e
.
printStackTrace
();
}
// Align
if
(
debug
>
0
)
System
.
err
.
println
(
"Directory: "
+
subdir
[
i
]);
align
(
subdir
[
i
]
);
}
}
}
public
void
align
(
File
dir
)
throws
Exception
{
public
void
align
(
File
dir
)
{
String
prefix
=
null
;
// toURI(). is not very good
AlignmentProcess
result
=
null
;
Alignment
init
=
null
;
PrintWriter
writer
=
null
;
if
(
urlprefix
!=
null
){
prefix
=
urlprefix
+
"/"
+
dir
.
getName
()+
"/"
;
...
...
@@ -263,74 +258,81 @@ public class GroupAlign {
}
//System.err.println("Here it is "+prefix+" (end by /?)");
BasicConfigurator
.
configure
();
if
(
uri1
==
null
)
{
uri1
=
new
URI
(
prefix
+
source
);}
if
(!
source
.
equalsIgnoreCase
(
"onto1.rdf"
)
&&
!
target
.
equalsIgnoreCase
(
"onto1.rdf"
)){
uri1
=
new
URI
(
prefix
+
source
);}
URI
uri2
=
new
URI
(
prefix
+
target
);
if
(
debug
>
1
)
System
.
err
.
println
(
" Handler set"
);
if
(
debug
>
1
)
System
.
err
.
println
(
" URI1: "
+
uri1
);
if
(
debug
>
1
)
System
.
err
.
println
(
" URI2: "
+
uri2
);
try
{
if
(
initName
!=
null
)
{
AlignmentParser
aparser
=
new
AlignmentParser
(
debug
-
1
);
init
=
aparser
.
parse
(
initName
);
uri1
=
init
.
getFile1
();
uri2
=
init
.
getFile2
();
if
(
debug
>
1
)
System
.
err
.
println
(
" Init parsed"
);
}
// Create alignment object
Object
[]
mparams
=
{};
Class
[]
cparams
=
{};
Class
<?>
alignmentClass
=
Class
.
forName
(
alignmentClassName
);
java
.
lang
.
reflect
.
Constructor
alignmentConstructor
=
alignmentClass
.
getConstructor
(
cparams
);
result
=
(
AlignmentProcess
)
alignmentConstructor
.
newInstance
(
mparams
);
result
.
init
(
uri1
,
uri2
);
}
catch
(
Exception
ex
)
{
System
.
err
.
println
(
"Cannot create alignment "
+
alignmentClassName
+
"\n"
+
ex
.
getMessage
());
throw
ex
;
}
if
(
debug
>
1
)
System
.
err
.
println
(
" Alignment structure created"
);
// Compute alignment
long
time
=
System
.
currentTimeMillis
();
result
.
align
(
init
,
params
);
// add opts
long
newTime
=
System
.
currentTimeMillis
();
result
.
setExtension
(
Namespace
.
ALIGNMENT
.
uri
,
Annotations
.
TIME
,
Long
.
toString
(
newTime
-
time
)
);
BasicConfigurator
.
configure
();
if
(
!
source
.
equalsIgnoreCase
(
"onto1.rdf"
)
&&
!
target
.
equalsIgnoreCase
(
"onto1.rdf"
)
)
{
uri1
=
new
URI
(
prefix
+
source
);
}
else
if
(
uri1
==
null
)
uri1
=
new
URI
(
prefix
+
source
);
URI
uri2
=
new
URI
(
prefix
+
target
);
if
(
debug
>
1
)
System
.
err
.
println
(
" Handler set"
);
if
(
debug
>
1
)
System
.
err
.
println
(
" URI1: "
+
uri1
);
if
(
debug
>
1
)
System
.
err
.
println
(
" URI2: "
+
uri2
);
try
{
if
(
initName
!=
null
)
{
AlignmentParser
aparser
=
new
AlignmentParser
(
debug
-
1
);
init
=
aparser
.
parse
(
initName
);
uri1
=
init
.
getFile1
();
uri2
=
init
.
getFile2
();
if
(
debug
>
1
)
System
.
err
.
println
(
" Init parsed"
);
}
if
(
debug
>
1
)
System
.
err
.
println
(
" Alignment performed"
);
// Create alignment object
Object
[]
mparams
=
{};
Class
[]
cparams
=
{};
Class
<?>
alignmentClass
=
Class
.
forName
(
alignmentClassName
);
java
.
lang
.
reflect
.
Constructor
alignmentConstructor
=
alignmentClass
.
getConstructor
(
cparams
);
result
=
(
AlignmentProcess
)
alignmentConstructor
.
newInstance
(
mparams
);
result
.
init
(
uri1
,
uri2
);
}
catch
(
Exception
ex
)
{
System
.
err
.
println
(
"Cannot create alignment "
+
alignmentClassName
+
"\n"
+
ex
.
getMessage
());
throw
ex
;
}
// Set output file
PrintWriter
writer
=
new
PrintWriter
(
new
BufferedWriter
(
new
OutputStreamWriter
(
new
FileOutputStream
(
dir
+
File
.
separator
+
filename
+
".rdf"
),
"UTF-8"
)),
true
);
AlignmentVisitor
renderer
=
null
;
if
(
debug
>
1
)
System
.
err
.
println
(
" Alignment structure created"
);
// Compute alignment
long
time
=
System
.
currentTimeMillis
();
result
.
align
(
init
,
params
);
// add opts
long
newTime
=
System
.
currentTimeMillis
();
result
.
setExtension
(
Namespace
.
ALIGNMENT
.
uri
,
Annotations
.
TIME
,
Long
.
toString
(
newTime
-
time
)
);
if
(
debug
>
1
)
System
.
err
.
println
(
" Alignment performed"
);
// Set output file
writer
=
new
PrintWriter
(
new
BufferedWriter
(
new
OutputStreamWriter
(
new
FileOutputStream
(
dir
+
File
.
separator
+
filename
+
".rdf"
),
"UTF-8"
)),
true
);
AlignmentVisitor
renderer
=
null
;
try
{
Object
[]
mparams
=
{
(
Object
)
writer
};
Class
[]
cparams
=
{
Class
.
forName
(
"java.io.PrintWriter"
)
};
java
.
lang
.
reflect
.
Constructor
rendererConstructor
=
Class
.
forName
(
rendererClass
).
getConstructor
(
cparams
);
renderer
=
(
AlignmentVisitor
)
rendererConstructor
.
newInstance
(
mparams
);
}
catch
(
Exception
ex
)
{
System
.
err
.
println
(
"Cannot create renderer "
+
rendererClass
+
"\n"
+
ex
.
getMessage
());
throw
ex
;
}
try
{
Object
[]
mparams
=
{
(
Object
)
writer
};
Class
[]
cparams
=
{
Class
.
forName
(
"java.io.PrintWriter"
)
};
java
.
lang
.
reflect
.
Constructor
rendererConstructor
=
Class
.
forName
(
rendererClass
).
getConstructor
(
cparams
);
renderer
=
(
AlignmentVisitor
)
rendererConstructor
.
newInstance
(
mparams
);
}
catch
(
Exception
ex
)
{
System
.
err
.
println
(
"Cannot create renderer "
+
rendererClass
+
"\n"
+
ex
.
getMessage
());
throw
ex
;
if
(
debug
>
1
)
System
.
err
.
println
(
" Outputing result to "
+
dir
+
File
.
separator
+
filename
+
".rdf"
);
// Output
result
.
render
(
renderer
);
if
(
debug
>
1
)
System
.
err
.
println
(
" Done..."
+
renderer
+
"\n"
);
}
catch
(
Exception
ex
)
{
if
(
debug
>
1
)
ex
.
printStackTrace
();
}
finally
{
// JE: This instruction is very important
if
(
writer
!=
null
)
writer
.
close
();
// Unload the ontologies
try
{
OntologyFactory
.
clear
();
}
catch
(
Exception
e
)
{};
}
if
(
debug
>
1
)
System
.
err
.
println
(
" Outputing result to "
+
dir
+
File
.
separator
+
filename
+
".rdf"
);
// Output
result
.
render
(
renderer
);
if
(
debug
>
1
)
System
.
err
.
println
(
" Done..."
+
renderer
+
"\n"
);
// It should be useful to unload ontologies
// JE: This instruction is very important
writer
.
close
();
}
public
void
usage
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment