PREFIX yago: PREFIX rdf: PREFIX xsd: PREFIX ontolex: PREFIX dct: PREFIX rdfs: PREFIX owl: PREFIX wikibase: PREFIX skos: PREFIX schema: PREFIX cc: PREFIX geo: PREFIX prov: PREFIX wd: PREFIX data: PREFIX sh: PREFIX s: PREFIX ref: PREFIX v: PREFIX wdt: PREFIX wpq: PREFIX wdtn: PREFIX p: PREFIX ps: PREFIX psv: PREFIX psn: PREFIX pq: PREFIX pqv: PREFIX pqn: PREFIX pr: PREFIX prv: PREFIX prn: PREFIX wdno: PREFIX ys: CONSTRUCT { ?s ?newp ?o . } WHERE { ?s ?p ?originalO . # Transforming the predicates to a new namespace where applicable BIND( IF(?p IN ( schema:administrates, schema:demonym, schema:highestPoint, schema:humanDevelopmentIndex, schema:influencedBy, schema:leader, schema:lowestPoint, schema:motto, schema:neighbors, schema:officialLanguage, schema:ownedBy, schema:populationNumber, schema:unemploymentRate ), URI(REPLACE(STR(?p), "http://schema.org/", "http://yago-knowledge.org/resource/")), ?p) AS ?newp ) # Transforming negative xsd:dateTime to xsd:dateTimeStamp BIND( IF(datatype(?originalO) = xsd:dateTime && STRSTARTS(STR(?originalO), "-"), STRDT(STR(?originalO), xsd:dateTimeStamp), ?originalO) AS ?o ) # Filtering out non-English literals and xsd:anyURI literals FILTER ( !( isLiteral(?o) && ( lang(?o) != "" && !( langMatches(lang(?o), "en") && lang(?o) != "en-gb" && lang(?o) != "en-ca" ) || datatype(?o) = xsd:anyURI || (?p = rdfs:label && str(?o) = "Generic instance") ) ) ) # Excluding specific predicates FILTER (?p != schema:sameAs) FILTER (?p != owl:sameAs) }