Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CSW2DCAT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open-Data
CSW2DCAT
Commits
2a520d9d
Commit
2a520d9d
authored
1 year ago
by
Jesper Zedlitz
Browse files
Options
Downloads
Patches
Plain Diff
Code formatiert, Logging bei Lizenzen verringert
parent
b5a691f8
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#690
passed
1 year ago
Stage: build
Changes
1
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/landsh/opendata/csw2dcat/MDMetadata2Dataset.java
+25
-30
25 additions, 30 deletions
.../java/de/landsh/opendata/csw2dcat/MDMetadata2Dataset.java
with
25 additions
and
30 deletions
src/main/java/de/landsh/opendata/csw2dcat/MDMetadata2Dataset.java
+
25
−
30
View file @
2a520d9d
...
@@ -25,10 +25,10 @@ import org.slf4j.Logger;
...
@@ -25,10 +25,10 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.MalformedURLException
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -46,11 +46,11 @@ public class MDMetadata2Dataset {
...
@@ -46,11 +46,11 @@ public class MDMetadata2Dataset {
static
IRIFactory
factory
=
IRIFactory
.
iriImplementation
();
static
IRIFactory
factory
=
IRIFactory
.
iriImplementation
();
private
final
Model
model
;
private
final
Model
model
;
private
final
Map
<
String
,
String
>
keywordMapping
=
new
HashMap
<>();
private
final
Map
<
String
,
String
>
keywordMapping
=
new
HashMap
<>();
private
final
Map
<
String
,
JSONObject
>
url2license
=
new
HashMap
<>();
Map
<
String
,
String
[]>
themeMapping
=
new
HashMap
<>();
Map
<
String
,
String
[]>
themeMapping
=
new
HashMap
<>();
boolean
ignoreInvalidMapping
=
true
;
boolean
ignoreInvalidMapping
=
true
;
private
CswInterface
cswInterface
;
private
CswInterface
cswInterface
;
private
BridgeSettings
settings
;
private
BridgeSettings
settings
;
private
final
Map
<
String
,
JSONObject
>
url2license
=
new
HashMap
<>();
public
MDMetadata2Dataset
(
Model
model
,
CswInterface
cswInterface
,
BridgeSettings
bridgeSettings
)
{
public
MDMetadata2Dataset
(
Model
model
,
CswInterface
cswInterface
,
BridgeSettings
bridgeSettings
)
{
this
(
model
);
this
(
model
);
...
@@ -563,7 +563,7 @@ public class MDMetadata2Dataset {
...
@@ -563,7 +563,7 @@ public class MDMetadata2Dataset {
if
(
license
!=
null
&&
license
.
has
(
"uri"
))
{
if
(
license
!=
null
&&
license
.
has
(
"uri"
))
{
resource
.
addProperty
(
DCTerms
.
license
,
model
.
createResource
(
license
.
getString
(
"uri"
)));
resource
.
addProperty
(
DCTerms
.
license
,
model
.
createResource
(
license
.
getString
(
"uri"
)));
}
else
{
}
else
{
log
.
info
(
"Unknown license: {}"
,
licenseURL
);
log
.
debug
(
"Unknown license: {}"
,
licenseURL
);
handleUnknownLicense
(
resource
,
licenseInformation
.
getString
(
"id"
));
handleUnknownLicense
(
resource
,
licenseInformation
.
getString
(
"id"
));
}
}
}
}
...
@@ -574,14 +574,10 @@ public class MDMetadata2Dataset {
...
@@ -574,14 +574,10 @@ public class MDMetadata2Dataset {
}
}
private
void
handleUnknownLicense
(
Resource
resource
,
String
licenseId
)
{
private
void
handleUnknownLicense
(
Resource
resource
,
String
licenseId
)
{
try
{
licenseId
=
URLEncoder
.
encode
(
licenseId
,
StandardCharsets
.
UTF_8
)
licenseId
=
URLEncoder
.
encode
(
licenseId
,
"UTF-8"
)
.
replaceAll
(
"%2F"
,
"/"
);
// Replace the encoded slash with the original slash
.
replaceAll
(
"%2F"
,
"/"
);
// Replace the encoded slash with the original slash
resource
.
addProperty
(
DCTerms
.
license
,
model
.
createResource
(
"http://dcat-ap.de/def/licenses/"
+
licenseId
));
resource
.
addProperty
(
DCTerms
.
license
,
model
.
createResource
(
"http://dcat-ap.de/def/licenses/"
+
licenseId
));
log
.
info
(
"Falling back to: {}"
,
licenseId
);
log
.
debug
(
"Falling back to: {}"
,
licenseId
);
}
catch
(
UnsupportedEncodingException
e
)
{
log
.
info
(
"Unable to encode licenseId: {}"
,
e
);
}
}
}
private
Resource
guessFormat
(
String
url
)
{
private
Resource
guessFormat
(
String
url
)
{
...
@@ -936,7 +932,6 @@ public class MDMetadata2Dataset {
...
@@ -936,7 +932,6 @@ public class MDMetadata2Dataset {
}
}
private
boolean
isMultiFormatDataset
(
Element
metadata
)
{
private
boolean
isMultiFormatDataset
(
Element
metadata
)
{
final
List
<
Node
>
formatElements
=
metadata
.
selectNodes
(
"gmd:distributionInfo/*/gmd:distributionFormat"
);
final
List
<
Node
>
formatElements
=
metadata
.
selectNodes
(
"gmd:distributionInfo/*/gmd:distributionFormat"
);
return
formatElements
.
size
()
>
1
;
return
formatElements
.
size
()
>
1
;
...
...
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