|
a/src/main/java/org/sba_research/timbus/kb/importer/PronomImporter.java |
|
b/src/main/java/org/sba_research/timbus/kb/importer/PronomImporter.java |
|
... |
|
... |
80 |
" OPTIONAL { ?s <http://reference.data.gov.uk/technical-registry/MIMETYPE> ?mimetype . }\n" +
|
80 |
" OPTIONAL { ?s <http://reference.data.gov.uk/technical-registry/MIMETYPE> ?mimetype . }\n" +
|
81 |
" OPTIONAL { ?s <http://reference.data.gov.uk/technical-registry/formatType> ?type. }\n" +
|
81 |
" OPTIONAL { ?s <http://reference.data.gov.uk/technical-registry/formatType> ?type. }\n" +
|
82 |
"}\n";// +
|
82 |
"}\n";// +
|
83 |
// "limit 250";
|
83 |
// "limit 250";
|
84 |
if (!formats.exists()) {
|
84 |
if (!formats.exists()) {
|
|
|
85 |
LOG.info("Querying endpoint...");
|
85 |
queryToFile(formats, sparqlQueryString);
|
86 |
queryToFile(formats, sparqlQueryString);
|
86 |
}
|
87 |
}
|
87 |
|
88 |
|
88 |
/*
|
89 |
/*
|
89 |
sparqlQueryString = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n" +
|
90 |
sparqlQueryString = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n" +
|
|
... |
|
... |
129 |
Model jenaModel = getJenaModel();
|
130 |
Model jenaModel = getJenaModel();
|
130 |
while (results.hasNext()) {
|
131 |
while (results.hasNext()) {
|
131 |
QuerySolution result = results.next();
|
132 |
QuerySolution result = results.next();
|
132 |
String ext = Utils.cleanExtension(result.getLiteral("ext").toString());
|
133 |
String ext = Utils.cleanExtension(result.getLiteral("ext").toString());
|
133 |
String puid = result.getLiteral("puid").toString();
|
134 |
String puid = result.getLiteral("puid").toString();
|
|
|
135 |
if (puid.equals("fmt/null")) {
|
|
|
136 |
puid = result.getLiteral("xpuid").toString();
|
|
|
137 |
}
|
134 |
if (ext.isEmpty() && puid.isEmpty()) {
|
138 |
if (ext.isEmpty() && puid.isEmpty()) {
|
135 |
LOG.severe("Neither extension nur PUID are set.");
|
139 |
LOG.severe("Neither extension nur PUID are set.");
|
136 |
continue;
|
140 |
continue;
|
137 |
}
|
141 |
}
|
138 |
for (OWLNamedIndividual indiv : findFormat(jenaModel, ext, puid)) {
|
142 |
Set<OWLNamedIndividual> pronomFormats = findFormat(jenaModel, ext, puid);
|
|
|
143 |
for (OWLNamedIndividual indiv : pronomFormats) {
|
139 |
try {
|
144 |
try {
|
140 |
OWLNamedIndividual registry = safeAddRegistry(indiv);
|
145 |
OWLNamedIndividual registry = safeAddRegistry(indiv);
|
141 |
if (result.contains("puid"))
|
146 |
if (result.contains("puid") || result.contains("xpuid"))
|
142 |
{
|
147 |
{
|
143 |
String pronomID = result.getLiteral("puid").getString();
|
|
|
144 |
if (pronomID.toLowerCase().equals("fmt/null")) {
|
148 |
if (puid.equals("fmt/null")) {
|
145 |
LOG.warning("Ignoring puid=fmt/null for: " + getName(indiv));
|
149 |
LOG.warning("Ignoring puid=fmt/null for: " + getName(indiv));
|
146 |
continue;
|
150 |
} else {
|
|
|
151 |
addEntryToRegistry(getName(indiv), "id", puid, registry);
|
147 |
}
|
152 |
}
|
148 |
addEntryToRegistry(getName(indiv), "id", pronomID, registry);
|
|
|
149 |
}
|
153 |
}
|
150 |
if (result.contains("mimetype")) {
|
154 |
if (result.contains("mimetype")) {
|
151 |
addEntryToRegistry(getName(indiv), "mimetype", result.getLiteral("mimetype").getString(), registry);
|
155 |
addEntryToRegistry(getName(indiv), "mimetype", result.getLiteral("mimetype").getString(), registry);
|
152 |
}
|
156 |
}
|
153 |
} catch (OwlElementNotFoundException e) {
|
157 |
} catch (OwlElementNotFoundException e) {
|