epistemik-co/staple-api

Issues when fetching DBpedia data

Opened this issue · 0 comments

There are sometimes issues when fetching data from DBpedia's SPARQL endpoint. This should be further investigated.

Steps to Reproduce

Ontology:

@prefix ds: <http://demo.staple-api.org/ontology.ttl#> .
@prefix dbo: <http://dbpedia.org/ontology/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix schema: <http://schema.org/> .

# classes (-> GraphQL types )
owl:Thing a rdfs:Class ;
rdfs:comment "Anything" .
dbo:Country a rdfs:Class ;
rdfs:comment "A country" ;
rdfs:subClassOf owl:Thing .
dbo:Person a rdfs:Class ;
rdfs:comment "A person" ;
rdfs:subClassOf owl:Thing .

# properties ( -> GraphQL fields )
rdfs:label a rdf:Property, owl:FunctionalProperty ;
rdfs:comment "Name of the entity" ;
schema:domainIncludes owl:Thing ;
schema:rangeIncludes xsd:string .
dbo:leader a rdf:Property ;
schema:domainIncludes dbo:Country ;
schema:rangeIncludes dbo:Person .

Config:

config = {
    dataSources: {
        default: "sparql",
        sparql: {
            id: "sparql",
            type: "sparql",
            url: "http://dbpedia.org/sparql",
            updateUrl: "http://dbpedia.org/sparql",
            graphName: "http://dbpedia.org"
        }
    }
}

Query:

{
  Country(filter:{_id:"http://dbpedia.org/resource/Turkey"}) {
    _id
    leader {
      _id
    }
  }
}

Output

{
  "errors": [
    {
      "message": "Could not insert RDF in graphy",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "Country"
      ]
    }
  ],
  "data": {
    "Country": null
  }
}