From b8325fb7b9113d53bd318591e2b4d5e0af981ce0 Mon Sep 17 00:00:00 2001 From: Alexander Barth Date: Fri, 14 Jan 2022 15:42:30 +0100 Subject: [PATCH] update Vocab: use rdf:Description instead of skos:Concept --- src/Vocab.jl | 10 ++++++---- test/test_vocab.jl | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Vocab.jl b/src/Vocab.jl index 56d60723..6a73d522 100644 --- a/src/Vocab.jl +++ b/src/Vocab.jl @@ -133,14 +133,15 @@ end function Concept(url::AbstractString) # Content Negotiation # http://vocab.nerc.ac.uk/ - @debug "get concept: $url" headers = [ "Accept" => "application/rdf+xml" ] + @debug "get concept: $url" + @debug "as curl -L -H \"$(join(headers[1],": "))\" \"$url\"" r = HTTP.get(url,headers) xdoc = parsexml(String(r.body)) - node = findfirst("skos:Concept", root(xdoc), namespaces) + node = findfirst("rdf:Description", root(xdoc), namespaces) return Concept(node) end @@ -239,10 +240,11 @@ function findbylabel( headers = [ "Accept" => "application/rdf+xml" ] - @debug "get collection: $collection.baseurl" + @debug "get collection: $(collection.baseurl)" + @debug "as curl -L -H \"$(join(headers[1],": "))\" \"$(collection.baseurl)\"" r = HTTP.get(collection.baseurl,headers) xdoc = EzXML.parsexml(String(r.body)) - concepts = Vocab.Concept.(findall("//skos:Concept", root(xdoc), Vocab.namespaces)) + concepts = Vocab.Concept.(findall("//rdf:Description", root(xdoc), Vocab.namespaces)) alllabels = Vocab.prefLabel.(concepts) foundconcepts = Vector{Vocab.Concept}(undef, length(labels)) diff --git a/test/test_vocab.jl b/test/test_vocab.jl index fdee8230..efb9526f 100644 --- a/test/test_vocab.jl +++ b/test/test_vocab.jl @@ -12,8 +12,9 @@ entry = collection["sea_water_temperature"] @test occursin("water", DIVAnd.Vocab.description(entry)) @test DIVAnd.Vocab.canonical_units(entry) == "K" - -#collection = DIVAnd.Vocab.Collection("http://www.seadatanet.org/urnurl/collection/P01/current/") +url = "https://vocab.nerc.ac.uk/collection/P01/current/PSALPR01" +c = DIVAnd.Vocab.Concept(url) +@test occursin("salinity", DIVAnd.Vocab.prefLabel(c)) collection = DIVAnd.Vocab.SDNCollection("P01")