metaphacts / semopenalex

41 stars 5 forks source link

add property and class descriptions #68

Open VladimirAlexiev opened 9 months ago

VladimirAlexiev commented 9 months ago

I know it's a drag, but you should add rdfs:comment for all ontology terms (properties and classes)

linnaung commented 8 months ago

will take note on this and will re-iterate the ontology.

EmidioStani commented 2 months ago

Definitions would really help, thanks !

VladimirAlexiev commented 2 months ago

hi @linnaung make a gsheet and let us help!

VladimirAlexiev commented 1 month ago

Hi @linnaung, @phaasenase, @davidlamprecht ! This query looks for defined terms:

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT * WHERE {
  values ?kind {rdfs:Class owl:Class rdf:Property owl:ObjectProperty owl:DatatypeProperty}
  ?x a ?kind
} order by ?x

Can you guarantee that all terms use only these kinds?

It returns 149, all are OWL terms, and there are no duplicates:

csvtk cut -f1 SemOpenAlex-terms.csv|sort|uniq -c
     25 http://www.w3.org/2002/07/owl#Class
     83 http://www.w3.org/2002/07/owl#DatatypeProperty
     41 http://www.w3.org/2002/07/owl#ObjectProperty
csvtk cut -f2 SemOpenAlex-terms.csv|sort|uniq -d

A count per ontology:

csvtk cut -f2 SemOpenAlex-terms.csv|perl -pe "s{[^/#\n]+$}{}" | sort|uniq -c
      1 http://id.nlm.nih.gov/mesh/vocab#
     13 http://metadata.un.org/sdg/ontology#   <<<<<<<
      5 http://prismstandard.org/namespaces/basic/2.0/
      8 http://purl.org/dc/terms/
      1 http://purl.org/spar/bido/
      1 http://purl.org/spar/cito/
      5 http://purl.org/spar/fabio/
      1 http://schema.org/
      4 http://www.geonames.org/ontology#
      1 http://www.w3.org/2000/01/rdf-schema#
      5 http://www.w3.org/2004/02/skos/core#
      1 http://www.w3.org/ns/org#
      3 http://xmlns.com/foaf/0.1/
      3 https://dbpedia.org/ontology/
      7 https://dbpedia.org/property/
     90 https://semopenalex.org/ontology/

The one marked <<<<<<< seems spurios to me, should I discard these terms?

VladimirAlexiev commented 1 month ago

Next I tried this and saved SemOpenAlex-props-describe.ttl

construct {?p ?x ?y}
where {
  values ?kind { owl:ObjectProperty owl:DatatypeProperty}
  ?p a ?kind; ?x ?y
}

And SemOpenAlex-classes-describe.ttl:

construct {?cl ?x ?y}
where {
  ?cl a owl:Class; ?x ?y
} 

Looked for fields that may ease understanding:

@davidlamprecht a few more prefixes to define:

VladimirAlexiev commented 1 month ago

I filtered to only used props by adding

filter exists {[] ?p []}

This returned the SDG props, so I wondered how are they used, eg

select * {
  ?x <http://metadata.un.org/sdg/ontology#isIndicatorOf> ?y
} limit 10

This shows they are used, not surprisingly, to describe more SDG stuff:

<http://metadata.un.org/sdg/C020102> sdg:isIndicatorOf <http://metadata.un.org/sdg/2.1>

But is SDG really used in SOA?

UPDATE: yes, Works are sometimes mapped to sdg:Goal.

VladimirAlexiev commented 1 month ago

Focusing on props in the SOA namespace first:

PREFIX soa: <https://semopenalex.org/ontology/>
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select ?p (group_concat(?class) as ?classes) ?kind {
  values ?kind { owl:ObjectProperty owl:DatatypeProperty}
  ?p a ?kind
  filter(strstarts(str(?p),str(soa:)))
  optional {
    ?node sh:property/sh:path ?p; sh:targetClass ?cl
    bind(strafter(str(?cl),str(soa:)) as ?class)
  }
} group by ?p ?kind order by ?p
VladimirAlexiev commented 1 month ago

Ok, I wrote descriptions of all classes and props in https://docs.google.com/spreadsheets/d/1Cy4OWsBc2NqjKPJZXKkKjcRWO_S14fbknwwRMtsP1cU/edit. Too bad I didn't think of consulting https://docs.openalex.org/api-entities/! But I think all descriptions are factual and useful.

Also added a list of prefixes to be added to repo.