metaphacts / linkedpaperswithcode

Code for generating Linked Papers with Code a high-quality RDF knowledge graph with metadata about the machine learning landscape.
https://linkedpaperswithcode.com
MIT License
3 stars 0 forks source link

use declared prefixes in SPARQL construct results (or declare SOA prefixes in LPWC) #8

Closed VladimirAlexiev closed 4 months ago

VladimirAlexiev commented 4 months ago

Continuing https://github.com/davidlamprecht/linkedpaperswithcode/issues/7, I tried this query at http://176.9.2.140:10216/sparql (will become https://linkedpaperswithcode.org/sparql shortly):

PREFIX dct: <http://purl.org/dc/terms/>
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX soa: <https://semopenalex.org/ontology/>
PREFIX dct: <http://purl.org/dc/terms/>
construct {?org ?p ?o} where {
  {select ?x {[] dct:creator ?x} limit 1}
  {service <https://semopenalex.org/sparql> {
      ?x org:memberOf ?org.
      ?org ?p ?o
  }}
}

Unlike YasGUI that returns a table, this returns turtle, which is better:

@prefix schema: <https://schema.org/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix sp: <http://spinrdf.org/sp#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix org: <http://www.w3.org/ns/org#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<https://semopenalex.org/institution/I57206974> a <https://semopenalex.org/ontology/Institution>;
  owl:sameAs <https://makg.org/entity/57206974>, <https://www.wikidata.org/wiki/Q49210>;
  <http://purl.org/dc/terms/created> "2016-06-24"^^xsd:date;
  <http://purl.org/dc/terms/modified> "2024-05-30"^^xsd:date;
  rdfs:seeAlso <https://en.wikipedia.org/wiki/New%20York%20University>;
  <https://semopenalex.org/ontology/citedByCount> 8616587;
  <https://semopenalex.org/ontology/worksCount> 229236;
  <https://semopenalex.org/ontology/countsByYear> <https://semopenalex.org/countsByYear/I57206974Y2012>,
    <https://semopenalex.org/countsByYear/I57206974Y2013>, <https://semopenalex.org/countsByYear/I57206974Y2014>,
    <https://semopenalex.org/countsByYear/I57206974Y2015>, <https://semopenalex.org/countsByYear/I57206974Y2016>,
    <https://semopenalex.org/countsByYear/I57206974Y2017>, <https://semopenalex.org/countsByYear/I57206974Y2018>,
    <https://semopenalex.org/countsByYear/I57206974Y2019>, <https://semopenalex.org/countsByYear/I57206974Y2020>,
    <https://semopenalex.org/countsByYear/I57206974Y2021>, <https://semopenalex.org/countsByYear/I57206974Y2022>,
    <https://semopenalex.org/countsByYear/I57206974Y2023>, <https://semopenalex.org/countsByYear/I57206974Y2024>;
  <https://semopenalex.org/ontology/magId> 57206974;
  <https://dbpedia.org/property/countryCode> "US";
  foaf:name "New York University";
  <https://semopenalex.org/ontology/ror> "https://ror.org/0190ak572";
  <https://dbpedia.org/ontology/alternativeName> "Universidad de Nueva York", "Université de New York";
  foaf:depiction "https://commons.wikimedia.org/w/index.php?title=Special:Redirect/file/Nyu%20short%20color.svg";
  foaf:homepage "http://www.nyu.edu/";
  <https://dbpedia.org/ontology/location> <https://semopenalex.org/geo/I57206974>;
  <https://dbpedia.org/property/acronym> "NYU";
  <https://semopenalex.org/ontology/grid> "grid.137628.9";
  <https://semopenalex.org/ontology/imageThumbnail> "https://commons.wikimedia.org/w/index.php?title=Special:Redirect/file/Nyu%20short%20color.svg&width=300";
  <https://semopenalex.org/ontology/rorType> "education";
  <https://semopenalex.org/ontology/hasChildInstitution> <https://semopenalex.org/institution/I258800397>,
    <https://semopenalex.org/institution/I120250893>, <https://semopenalex.org/institution/I36672615>,
    <https://semopenalex.org/institution/I2799442855>, <https://semopenalex.org/institution/I4210123063>,
    <https://semopenalex.org/institution/I4210165353>;
  <https://semopenalex.org/ontology/hasAssociatedInstitution> <https://semopenalex.org/institution/I4210086933>,
    <https://semopenalex.org/institution/I2802707398>, <https://semopenalex.org/institution/I2800015068>,
    <https://semopenalex.org/institution/I4210108985>, <https://semopenalex.org/institution/I4210163050>,
    <https://semopenalex.org/institution/I4210160702>, <https://semopenalex.org/institution/I42102869> .

<https://semopenalex.org/institution/I27837315> a <https://semopenalex.org/ontology/Institution>;
  owl:sameAs <https://makg.org/entity/27837315>, <https://www.wikidata.org/wiki/Q230492>;
  <http://purl.org/dc/terms/created> "2016-06-24"^^xsd:date;
  <http://purl.org/dc/terms/modified> "2024-05-29"^^xsd:date;
  rdfs:seeAlso <https://en.wikipedia.org/wiki/University%20of%20Michigan>;
  <https://semopenalex.org/ontology/citedByCount> 17535410;
  <https://semopenalex.org/ontology/worksCount> 885687;
  <https://semopenalex.org/ontology/countsByYear> <https://semopenalex.org/countsByYear/I27837315Y2012>,
    <https://semopenalex.org/countsByYear/I27837315Y2013>, <https://semopenalex.org/countsByYear/I27837315Y2014>,
    <https://semopenalex.org/countsByYear/I27837315Y2015>, <https://semopenalex.org/countsByYear/I27837315Y2016>,
    <https://semopenalex.org/countsByYear/I27837315Y2017>, <https://semopenalex.org/countsByYear/I27837315Y2018>,
    <https://semopenalex.org/countsByYear/I27837315Y2019>, <https://semopenalex.org/countsByYear/I27837315Y2020>,
    <https://semopenalex.org/countsByYear/I27837315Y2021>, <https://semopenalex.org/countsByYear/I27837315Y2022>,
    <https://semopenalex.org/countsByYear/I27837315Y2023>, <https://semopenalex.org/countsByYear/I27837315Y2024>;
  <https://semopenalex.org/ontology/magId> 27837315;
  <https://dbpedia.org/property/countryCode> "US";
  foaf:name "University of Michigan–Ann Arbor";
  <https://semopenalex.org/ontology/ror> "https://ror.org/00jmfr291";
  <https://dbpedia.org/ontology/alternativeName> "University of Michigan", "UMich",
    "Université du Michigan";
  foaf:depiction "https://commons.wikimedia.org/w/index.php?title=Special:Redirect/file/University%20of%20Michigan%20logo.svg";
  foaf:homepage "https://www.umich.edu";
  <https://dbpedia.org/ontology/location> <https://semopenalex.org/geo/I27837315>;
  <https://dbpedia.org/property/acronym> "UM";
  <https://semopenalex.org/ontology/grid> "grid.214458.e";
  <https://semopenalex.org/ontology/imageThumbnail> "https://commons.wikimedia.org/w/index.php?title=Special:Redirect/file/University%20of%20Michigan%20logo.svg&width=300";
  <https://semopenalex.org/ontology/rorType> "education";
  <https://semopenalex.org/ontology/hasChildInstitution> <https://semopenalex.org/institution/I4210163254>,
    <https://semopenalex.org/institution/I4210104572>, <https://semopenalex.org/institution/I4210130704>,
    <https://semopenalex.org/institution/I4210092198>;
  <https://semopenalex.org/ontology/hasAssociatedInstitution> <https://semopenalex.org/institution/I2801799315>,
    <https://semopenalex.org/institution/I4210114445> .

<https://semopenalex.org/institution/I36672615> a <https://semopenalex.org/ontology/Institution>;
  owl:sameAs <https://makg.org/entity/36672615>, <https://www.wikidata.org/wiki/Q946028>;
  <http://purl.org/dc/terms/created> "2016-06-24"^^xsd:date;
  <http://purl.org/dc/terms/modified> "2024-05-30"^^xsd:date;
  rdfs:seeAlso <https://en.wikipedia.org/wiki/Courant%20Institute%20of%20Mathematical%20Sciences>;
  <https://semopenalex.org/ontology/citedByCount> 723289;
  <https://semopenalex.org/ontology/worksCount> 14169;
  <https://semopenalex.org/ontology/countsByYear> <https://semopenalex.org/countsByYear/I36672615Y2012>,
    <https://semopenalex.org/countsByYear/I36672615Y2013>, <https://semopenalex.org/countsByYear/I36672615Y2014>,
    <https://semopenalex.org/countsByYear/I36672615Y2015>, <https://semopenalex.org/countsByYear/I36672615Y2016>,
    <https://semopenalex.org/countsByYear/I36672615Y2017>, <https://semopenalex.org/countsByYear/I36672615Y2018>,
    <https://semopenalex.org/countsByYear/I36672615Y2019>, <https://semopenalex.org/countsByYear/I36672615Y2020>,
    <https://semopenalex.org/countsByYear/I36672615Y2021>, <https://semopenalex.org/countsByYear/I36672615Y2022>,
    <https://semopenalex.org/countsByYear/I36672615Y2023>, <https://semopenalex.org/countsByYear/I36672615Y2024>;
  <https://semopenalex.org/ontology/magId> 36672615;
  <https://dbpedia.org/property/countryCode> "US";
  foaf:name "Courant Institute of Mathematical Sciences";
  <https://semopenalex.org/ontology/ror> "https://ror.org/037tm7f56";
  foaf:depiction "https://commons.wikimedia.org/w/index.php?title=Special:Redirect/file/WarrenWeaverHall.JPG";
  foaf:homepage "http://www.cims.nyu.edu/";
  <https://dbpedia.org/ontology/location> <https://semopenalex.org/geo/I36672615>;
  <https://dbpedia.org/property/acronym> "CIMS";
  <https://semopenalex.org/ontology/grid> "grid.482020.c";
  <https://semopenalex.org/ontology/imageThumbnail> "https://commons.wikimedia.org/w/index.php?title=Special:Redirect/file/WarrenWeaverHall.JPG&width=300";
  <https://semopenalex.org/ontology/rorType> "education";
  <https://semopenalex.org/ontology/hasParentInstitution> <https://semopenalex.org/institution/I57206974> .

However, it doesn't use prefixed declared in the query. I suspect it only uses namespaces existing in the LPWC repo. If that is the case, then please define all SOA prefixes in the LPWC repo.

davidlamprecht commented 4 months ago

Hi @VladimirAlexiev , I have added all namespaces from the semopenalex.org metaphactory to the linkedpaperswithcode.com metaphactory. Let me know if any namespaces are still missing. Then I will define them too.

Your provided Query now returns the following result when being executed against https://linkedpaperswithcode.com/sparql:


@prefix schema: <https://schema.org/> .
@prefix soa: <https://semopenalex.org/ontology/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix sp: <http://spinrdf.org/sp#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix dbprop: <https://dbpedia.org/property/> .
@prefix jsfn: <http://www.ontotext.com/js#> .
@prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
@prefix dbpedia-owl: <https://dbpedia.org/ontology/> .
@prefix org: <http://www.w3.org/ns/org#> .
@prefix fabio: <http://purl.org/spar/fabio/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<https://semopenalex.org/institution/I57206974> a soa:Institution;
  owl:sameAs <https://makg.org/entity/57206974>, <https://www.wikidata.org/wiki/Q49210>;
  dct:created "2016-06-24"^^xsd:date;
  dct:modified "2024-05-30"^^xsd:date;
  rdfs:seeAlso <https://en.wikipedia.org/wiki/New%20York%20University>;
  soa:citedByCount 8616587;
  soa:worksCount 229236;
  soa:countsByYear <https://semopenalex.org/countsByYear/I57206974Y2012>, <https://semopenalex.org/countsByYear/I57206974Y2013>,
    <https://semopenalex.org/countsByYear/I57206974Y2014>, <https://semopenalex.org/countsByYear/I57206974Y2015>,
    <https://semopenalex.org/countsByYear/I57206974Y2016>, <https://semopenalex.org/countsByYear/I57206974Y2017>,
    <https://semopenalex.org/countsByYear/I57206974Y2018>, <https://semopenalex.org/countsByYear/I57206974Y2019>,
    <https://semopenalex.org/countsByYear/I57206974Y2020>, <https://semopenalex.org/countsByYear/I57206974Y2021>,
    <https://semopenalex.org/countsByYear/I57206974Y2022>, <https://semopenalex.org/countsByYear/I57206974Y2023>,
    <https://semopenalex.org/countsByYear/I57206974Y2024>;
  soa:magId 57206974;
  dbprop:countryCode "US";
  foaf:name "New York University";
  soa:ror "https://ror.org/0190ak572";
  dbpedia-owl:alternativeName "Universidad de Nueva York", "Université de New York";
  foaf:depiction "https://commons.wikimedia.org/w/index.php?title=Special:Redirect/file/Nyu%20short%20color.svg";
  foaf:homepage "http://www.nyu.edu/";
  dbpedia-owl:location <https://semopenalex.org/geo/I57206974>;
  dbprop:acronym "NYU";
  soa:grid "grid.137628.9";
  soa:imageThumbnail "https://commons.wikimedia.org/w/index.php?title=Special:Redirect/file/Nyu%20short%20color.svg&width=300";
  soa:rorType "education";
  soa:hasChildInstitution <https://semopenalex.org/institution/I258800397>, <https://semopenalex.org/institution/I120250893>,
    <https://semopenalex.org/institution/I36672615>, <https://semopenalex.org/institution/I2799442855>,
    <https://semopenalex.org/institution/I4210123063>, <https://semopenalex.org/institution/I4210165353>;
  soa:hasAssociatedInstitution <https://semopenalex.org/institution/I4210086933>, <https://semopenalex.org/institution/I2802707398>,
    <https://semopenalex.org/institution/I2800015068>, <https://semopenalex.org/institution/I4210108985>,
    <https://semopenalex.org/institution/I4210163050>, <https://semopenalex.org/institution/I4210160702>,
    <https://semopenalex.org/institution/I42102869> .

<https://semopenalex.org/institution/I27837315> a soa:Institution;
  owl:sameAs <https://makg.org/entity/27837315>, <https://www.wikidata.org/wiki/Q230492>;
  dct:created "2016-06-24"^^xsd:date;
  dct:modified "2024-05-29"^^xsd:date;
  rdfs:seeAlso <https://en.wikipedia.org/wiki/University%20of%20Michigan>;
  soa:citedByCount 17535410;
  soa:worksCount 885687;
  soa:countsByYear <https://semopenalex.org/countsByYear/I27837315Y2012>, <https://semopenalex.org/countsByYear/I27837315Y2013>,
    <https://semopenalex.org/countsByYear/I27837315Y2014>, <https://semopenalex.org/countsByYear/I27837315Y2015>,
    <https://semopenalex.org/countsByYear/I27837315Y2016>, <https://semopenalex.org/countsByYear/I27837315Y2017>,
    <https://semopenalex.org/countsByYear/I27837315Y2018>, <https://semopenalex.org/countsByYear/I27837315Y2019>,
    <https://semopenalex.org/countsByYear/I27837315Y2020>, <https://semopenalex.org/countsByYear/I27837315Y2021>,
    <https://semopenalex.org/countsByYear/I27837315Y2022>, <https://semopenalex.org/countsByYear/I27837315Y2023>,
    <https://semopenalex.org/countsByYear/I27837315Y2024>;
  soa:magId 27837315;
  dbprop:countryCode "US";
  foaf:name "University of Michigan–Ann Arbor";
  soa:ror "https://ror.org/00jmfr291";
  dbpedia-owl:alternativeName "University of Michigan", "UMich", "Université du Michigan";
  foaf:depiction "https://commons.wikimedia.org/w/index.php?title=Special:Redirect/file/University%20of%20Michigan%20logo.svg";
  foaf:homepage "https://www.umich.edu";
  dbpedia-owl:location <https://semopenalex.org/geo/I27837315>;
  dbprop:acronym "UM";
  soa:grid "grid.214458.e";
  soa:imageThumbnail "https://commons.wikimedia.org/w/index.php?title=Special:Redirect/file/University%20of%20Michigan%20logo.svg&width=300";
  soa:rorType "education";
  soa:hasChildInstitution <https://semopenalex.org/institution/I4210163254>, <https://semopenalex.org/institution/I4210104572>,
    <https://semopenalex.org/institution/I4210130704>, <https://semopenalex.org/institution/I4210092198>;
  soa:hasAssociatedInstitution <https://semopenalex.org/institution/I2801799315>, <https://semopenalex.org/institution/I4210114445> .

<https://semopenalex.org/institution/I36672615> a soa:Institution;
  owl:sameAs <https://makg.org/entity/36672615>, <https://www.wikidata.org/wiki/Q946028>;
  dct:created "2016-06-24"^^xsd:date;
  dct:modified "2024-05-30"^^xsd:date;
  rdfs:seeAlso <https://en.wikipedia.org/wiki/Courant%20Institute%20of%20Mathematical%20Sciences>;
  soa:citedByCount 723289;
  soa:worksCount 14169;
  soa:countsByYear <https://semopenalex.org/countsByYear/I36672615Y2012>, <https://semopenalex.org/countsByYear/I36672615Y2013>,
    <https://semopenalex.org/countsByYear/I36672615Y2014>, <https://semopenalex.org/countsByYear/I36672615Y2015>,
    <https://semopenalex.org/countsByYear/I36672615Y2016>, <https://semopenalex.org/countsByYear/I36672615Y2017>,
    <https://semopenalex.org/countsByYear/I36672615Y2018>, <https://semopenalex.org/countsByYear/I36672615Y2019>,
    <https://semopenalex.org/countsByYear/I36672615Y2020>, <https://semopenalex.org/countsByYear/I36672615Y2021>,
    <https://semopenalex.org/countsByYear/I36672615Y2022>, <https://semopenalex.org/countsByYear/I36672615Y2023>,
    <https://semopenalex.org/countsByYear/I36672615Y2024>;
  soa:magId 36672615;
  dbprop:countryCode "US";
  foaf:name "Courant Institute of Mathematical Sciences";
  soa:ror "https://ror.org/037tm7f56";
  foaf:depiction "https://commons.wikimedia.org/w/index.php?title=Special:Redirect/file/WarrenWeaverHall.JPG";
  foaf:homepage "http://www.cims.nyu.edu/";
  dbpedia-owl:location <https://semopenalex.org/geo/I36672615>;
  dbprop:acronym "CIMS";
  soa:grid "grid.482020.c";
  soa:imageThumbnail "https://commons.wikimedia.org/w/index.php?title=Special:Redirect/file/WarrenWeaverHall.JPG&width=300";
  soa:rorType "education";
  soa:hasParentInstitution <https://semopenalex.org/institution/I57206974> .
VladimirAlexiev commented 4 months ago

@davidlamprecht Thanks!! But I noticed a mistake about dbpedia:

davidlamprecht commented 4 months ago

@VladimirAlexiev thanks for the feedback.

I have updated: dbpedia-owl -> dbo dbprop -> dbp

The correct use of http to DBpedia is already tracked in Issue 3: https://github.com/davidlamprecht/linkedpaperswithcode/issues/3 we will update our mappings for the next LPWC Version.

davidlamprecht commented 4 months ago

@VladimirAlexiev I have updated all DBpedia terms in the current data and Ontology from https to http.

E.g. http://dbpedia.org/property/area

VladimirAlexiev commented 3 months ago

@davidlamprecht Please register these prefixes as well (the shoemaker goes barefoot :-)

PREFIX lpwcc: <https://linkedpaperswithcode.com/class/>
PREFIX lpwc: <https://linkedpaperswithcode.com/property/>

I've added them to prefix.cc