Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
corpus-services
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lange, Dr. Herbert
corpus-services
Commits
372b45e2
Commit
372b45e2
authored
3 years ago
by
Lange, Dr. Herbert
Browse files
Options
Downloads
Patches
Plain Diff
remove report as function parameter and add segmented exmaralda support
parent
79b5fccd
No related branches found
No related tags found
1 merge request
!6
add feature to load criteria file from resource and place all criteria files...
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/uni_hamburg/corpora/validation/quest/LinkedFileChecker.java
+43
-17
43 additions, 17 deletions
...i_hamburg/corpora/validation/quest/LinkedFileChecker.java
with
43 additions
and
17 deletions
src/main/java/de/uni_hamburg/corpora/validation/quest/LinkedFileChecker.java
+
43
−
17
View file @
372b45e2
...
...
@@ -138,13 +138,15 @@ public class LinkedFileChecker extends Checker implements CorpusFunction {
List
<
URI
>
refFiles
=
new
ArrayList
<>();
try
{
if
(
cd
instanceof
ComaData
)
refFiles
.
addAll
(
getReferencedFiles
(
report
,
(
ComaData
)
cd
));
refFiles
.
addAll
(
getReferencedFiles
((
ComaData
)
cd
));
else
if
(
cd
instanceof
EXMARaLDATranscriptionData
)
refFiles
.
addAll
(
getReferencedFiles
(
report
,
(
EXMARaLDATranscriptionData
)
cd
));
refFiles
.
addAll
(
getReferencedFiles
((
EXMARaLDATranscriptionData
)
cd
));
else
if
(
cd
instanceof
EXMARaLDASegmentedTranscriptionData
)
refFiles
.
addAll
(
getReferencedFiles
((
EXMARaLDASegmentedTranscriptionData
)
cd
));
else
if
(
cd
instanceof
ELANData
)
refFiles
.
addAll
(
getReferencedFiles
(
report
,
(
ELANData
)
cd
));
refFiles
.
addAll
(
getReferencedFiles
((
ELANData
)
cd
));
else
if
(
cd
instanceof
IMDIData
)
refFiles
.
addAll
(
getReferencedFiles
(
report
,
(
IMDIData
)
cd
));
refFiles
.
addAll
(
getReferencedFiles
((
IMDIData
)
cd
));
}
catch
(
JDOMException
|
MalformedURLException
|
URISyntaxException
e
)
{
report
.
addCritical
(
getFunction
(),
ReportItem
.
newParamMap
(
...
...
@@ -173,6 +175,7 @@ public class LinkedFileChecker extends Checker implements CorpusFunction {
Set
<
Class
<?
extends
CorpusData
>>
usableFor
=
new
HashSet
<>();
usableFor
.
add
(
ComaData
.
class
);
usableFor
.
add
(
EXMARaLDATranscriptionData
.
class
);
usableFor
.
add
(
EXMARaLDASegmentedTranscriptionData
.
class
);
usableFor
.
add
(
ELANData
.
class
);
usableFor
.
add
(
IMDIData
.
class
);
// usableFor.add(TEIData.class);
...
...
@@ -185,14 +188,13 @@ public class LinkedFileChecker extends Checker implements CorpusFunction {
/**
* Gets the list of files from an Coma corpus file
*
* @param report the report to store potential problems
* @param cd the corpus file
* @return the list of URIs for all referenced files
* @throws JDOMException on problems accessing information using xpath
* @throws MalformedURLException on problems creating URIs
* @throws URISyntaxException on problems creating URIs
*/
private
List
<
URI
>
getReferencedFiles
(
Report
report
,
ComaData
cd
)
throws
JDOMException
,
MalformedURLException
,
URISyntaxException
{
private
List
<
URI
>
getReferencedFiles
(
ComaData
cd
)
throws
JDOMException
,
MalformedURLException
,
URISyntaxException
{
ArrayList
<
URI
>
files
=
new
ArrayList
<>();
Set
<
String
>
part1
=
new
HashSet
<>(
Arrays
.
asList
(
"Transcription"
,
"transcription"
,
"Media"
,
"media"
));
...
...
@@ -218,16 +220,38 @@ public class LinkedFileChecker extends Checker implements CorpusFunction {
/**
* Gets the list of files from an EXMARaLDA corpus file
*
* @param report the report to store potential problems
* @param cd the corpus file
* @return the list of URIs for all referenced files
* @throws JDOMException on problems accessing information using xpath
* @throws MalformedURLException on problems creating URIs
* @throws URISyntaxException on problems creating URIs
*/
private
List
<
URI
>
getReferencedFiles
(
Report
report
,
EXMARaLDATranscriptionData
cd
)
throws
JDOMException
,
MalformedURLException
,
URISyntaxException
{
private
List
<
URI
>
getReferencedFiles
(
EXMARaLDATranscriptionData
cd
)
throws
JDOMException
,
MalformedURLException
,
URISyntaxException
{
ArrayList
<
URI
>
files
=
new
ArrayList
<>();
List
<
Element
>
referencedFiles
=
XPath
.
newInstance
(
"//referenced-file"
).
selectNodes
(
cd
.
getJdom
());
List
<
Element
>
referencedFiles
=
new
ArrayList
<>(
XPath
.
newInstance
(
"//referenced-file"
).
selectNodes
(
cd
.
getJdom
()));
for
(
Element
file
:
referencedFiles
)
{
File
tmpFile
=
new
File
(
new
URL
(
cd
.
getParentURL
()
+
file
.
getAttribute
(
"url"
).
getValue
()).
toURI
());
URI
fileUri
=
tmpFile
.
toURI
();
files
.
add
(
fileUri
);
}
return
files
;
}
/**
* Gets the list of files from an EXMARaLDA segmented corpus file
*
* @param cd the corpus file
* @return the list of URIs for all referenced files
* @throws JDOMException on problems accessing information using xpath
* @throws MalformedURLException on problems creating URIs
* @throws URISyntaxException on problems creating URIs
*/
private
List
<
URI
>
getReferencedFiles
(
EXMARaLDASegmentedTranscriptionData
cd
)
throws
JDOMException
,
MalformedURLException
,
URISyntaxException
{
ArrayList
<
URI
>
files
=
new
ArrayList
<>();
List
<
Element
>
referencedFiles
=
new
ArrayList
<>(
XPath
.
newInstance
(
"//referenced-file"
).
selectNodes
(
cd
.
getJdom
()));
for
(
Element
file
:
referencedFiles
)
{
File
tmpFile
=
new
File
(
new
URL
(
cd
.
getParentURL
()
+
file
.
getAttribute
(
"url"
).
getValue
()).
toURI
());
...
...
@@ -240,36 +264,38 @@ public class LinkedFileChecker extends Checker implements CorpusFunction {
/**
* Gets the list of files from an ELAN corpus file
*
* @param report the report to store potential problems
* @param cd the corpus file
* @return the list of URIs for all referenced files
* @throws JDOMException on problems accessing information using xpath
* @throws MalformedURLException on problems creating URIs
* @throws URISyntaxException on problems creating URIs
*/
private
List
<
URI
>
getReferencedFiles
(
Report
report
,
ELANData
cd
)
throws
JDOMException
,
MalformedURLException
,
URISyntaxException
{
private
List
<
URI
>
getReferencedFiles
(
ELANData
cd
)
throws
JDOMException
,
MalformedURLException
,
URISyntaxException
{
ArrayList
<
URI
>
files
=
new
ArrayList
<>();
List
<
Element
>
referencedFiles
=
XPath
.
newInstance
(
"//MEDIA_DESCRIPTOR"
).
selectNodes
(
cd
.
getJdom
());
List
<
Element
>
referencedFiles
=
new
ArrayList
<>(
XPath
.
newInstance
(
"//MEDIA_DESCRIPTOR"
).
selectNodes
(
cd
.
getJdom
()));
for
(
Element
file
:
referencedFiles
)
{
logger
.
info
(
file
.
toString
());
if
(
file
.
getAttributeValue
(
"RELATIVE_MEDIA_URL"
)
!=
null
)
{
File
tmpFile
=
new
File
(
new
URL
(
cd
.
getParentURL
()
+
file
.
getAttribute
(
"RELATIVE_MEDIA_URL"
)
.
getValue
()
).
toURI
());
file
.
getAttribute
Value
(
"RELATIVE_MEDIA_URL"
)).
toURI
());
URI
fileUri
=
tmpFile
.
toURI
();
files
.
add
(
fileUri
);
}
}
return
files
;
}
/**
* Gets the list of files from an IMDI corpus file
*
* @param report the report to store potential problems
* @param cd the corpus file
* @return the list of URIs for all referenced files
* @throws JDOMException on problems accessing information using xpath
* @throws MalformedURLException on problems creating URIs
* @throws URISyntaxException on problems creating URIs
*/
private
List
<
URI
>
getReferencedFiles
(
Report
report
,
IMDIData
cd
)
throws
JDOMException
,
MalformedURLException
,
URISyntaxException
{
private
List
<
URI
>
getReferencedFiles
(
IMDIData
cd
)
throws
JDOMException
,
MalformedURLException
,
URISyntaxException
{
ArrayList
<
URI
>
files
=
new
ArrayList
<>();
List
<
Element
>
referencedFiles
=
XPath
.
newInstance
(
"//MEDIA_DESCRIPTOR"
).
selectNodes
(
cd
.
getJdom
());
for
(
Element
file
:
referencedFiles
)
{
...
...
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