Skip to content

Commit

Permalink
update Vocab: use rdf:Description instead of skos:Concept
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Jan 14, 2022
1 parent 20ccc0b commit b8325fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/Vocab.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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))
Expand Down
5 changes: 3 additions & 2 deletions test/test_vocab.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit b8325fb

Please sign in to comment.