owl:equivalentProperty relations between DBPedia and Yago - sparql

Is there any graph that contains mappings between equivalent properties in DBPedia and Yago? My application requires to "merge" triples that express the same meaning in both datasets, but I couldn't find any.
The following query returns an empty result at the Yago endpoint and only very few entries at the DBPedia endpoint.
prefix owl: <http://www.w3.org/2002/07/owl#>
select ?s ?o
where {
?s owl:equivalentProperty ?o .
}

There are some tools that automatically generated mappings between classes and properties of DBpedia and Yago. You can download some of these files here:
Yago to DBpedia linking

Related

Sparql Query to retrieve all the properties and classes belong to specific class

I have ontology URI and I need to know all the properties and classes belongs to this ontology.
the URI of the ontology Prefix Names: http://data.Ordanancesurvery.cor.uk/ontology/OpenName#.
It is hosted by ordnance survey and The API is:
https://data.ordnancesurvey.co.uk/datasets/os-linked-data/explorer/sparql
I need Sparql query which can retrieve all the classes and properties from the ontology.
PREFIX Names: <http://data.ordnancesurvey.co.uk/ontology/OpenNames/>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl:<http://www.w3.org/2002/07/owl#>
SELECT ?s ?p ?o
WHERE {
?s ?p ?o
Filter (regex (?o,"OpenNames"))
}
I am trying to retrieve all the classes and properties, belong to the ontology OpenNames under the uri : http://data.ordnancesurvey.co.uk/ontology/OpenNames/
URIs are not strings. Conversion is not automatic. Use str(?o)
regex (str(?o),"OpenNames") or CONTAINS(str(?o),"OpenNames")
Better is
STRSTARTS(str(?o), str(Names:))
Prefixes are expanded during parsing so
str(Names:)
is the same as writing
str(<http://data.ordnancesurvey.co.uk/ontology/OpenNames/>)
then STRSTARTS does a leading string test.

A problem with querying a graph with SPARQL on Bioportal

I am querying an ontology on the Bioportal endpoint. The ontology (NIF) is stored as a graph, so I put it in the FROM clause as the endpoint instructed.
SELECT DISTINCT ?p
FROM <http://bioportal.bioontology.org/ontologies/NIF>
WHERE{
?p a rdf:Property
}
limit 100
However, as can be seen below, the results came back showing few properties related to NIF and others to a different ontology called SKOS (Simple Knowledge Organization System).
In the Bioportal documentation it is said it maps some properties to SKOS properties, so I thought maybe the results are fine.
However, I had to test if I am querying the correct graph. So I used the below code to count the number of nodes since I know the NIF has around 3.6 million triples!
SELECT (count (*) as ?nodes)
FROM <http://bioportal.bioontology.org/ontologies/NIF>
WHERE{
?s ?p ?o
}
This resulted in 7984 nodes with and without the FROM clause! So I guessed I should be using the "count" incorrectly!
So I wonder how I should make sure that I am just querying the NIF ontology. Also, how to count its nodes?
Thanks :)
Try using SERVICE keyword.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT (count (*) as ?nodes)
WHERE
{
SERVICE <http://bioportal.bioontology.org/ontologies/NIF>
{
?s ?p ?o
}
}
If this fails, possibly the service you are connecting is not correct or up.
Try below example which connects to DBpedia:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT (count (*) as ?nodes)
WHERE
{
SERVICE <http://DBpedia.org/sparql>
{
?s ?p ?o
}
}
By the way I can;t access URL http://bioportal.bioontology.org/ontologies/NIF. Seems to be unavailable or down.

How to reference different repositories in a SPARQL query (federated)?

I would like to know what are the triples that are in a repository but that are not included in other repository.
But for doing this, I would need to reference the two repositories in a federated query.
I'm using Allegrograph.
Example on FactForge (i. e., using SPARQL 1.1 federated queries, not Allegrograph's federated stores):
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbr: <http://dbpedia.org/resource/>
CONSTRUCT { ?s ?p ?o }
{
VALUES (?s) {(dbr:Yekaterinburg)}
?s ?p ?o.
MINUS
{
SERVICE <http://dbpedia.org/sparql>
{
VALUES (?s) {(dbr:Yekaterinburg)}
?s ?p ?o
}
}
}
Obviously, one can't subtract DBpedia from DBpedia Live in this way, at least one resultset should be relatively small. It seems that Allegrograph's federated stores couldn't help in such substraction task. Probably you should divide your triples into named graphs, not into separate stores.
With AllegroGraph there are 2 ways this can be achieved:
(1) AllegroGraph allows you to federate multiple local and/or remote triple stores into a single virtual store which can then be queried as a single triple store.
(2) You can use SPARQL 1.1 federated queries which use the SERVICE keyword. Here is an example from the Learning SPARQL book:
PREFIX gp: <http://wifo5-04.informatik.uni-mannheim.de/gutendata/resource/people/>
SELECT ?dbpProperty ?dbpValue ?gutenProperty ?gutenValue
WHERE
{
SERVICE <http://DBpedia.org/sparql>
{
<http://dbpedia.org/resource/Joseph_Hocking> ?dbpProperty ?dbpValue .
}
SERVICE <http://wifo5-04.informatik.uni-mannheim.de/gutendata/sparql>
{
gp:Hocking_Joseph ?gutenProperty ?gutenValue .
}
}

SPARQL Query to get property that involve one or more individuals

How do I run a generic sparql query on yago's endpoint to get "concrete" results? For example, I would like to get results like this:
"<ELSA_Einstein> <isMarriedTo> <Albert_Einstein>"
"<Albert_Einstein> <hasAccademicAdvisor> <Alfred_Kleiner>"
etc ..
leave the link on which to explore on Yago ontology YAGO BROWSER. As you can see, these are sentences with a sense, I tried to run this query on this sparql endpoint for ago SPARQL ENDPOINT FOR YAGO
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?x ?p ?y
WHERE {
?x ?p ?y.
VALUE ?p {rdf: type}
} LIMIT 20
but the results are not like the ones I posted above here, Results (valid triple example ), how can I bind the predicate so as to get these types of results involving two individuals or at most one 'object must be a string, integer, etc. (literal)?

Jena fuseki owl ontology

I installed Jena Fuseki and want to be able to get classes from my own OWL file.
The following query returns the classes from owl and rdfs but not from ont. How can I retrieve them? I eventually want to add data to TDB using parts from my own OWL ontology when querying with Fuseki. I'm using Fuseki version: 2.3.1.
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix ont: <http://wad.nistorandrei.com/ontology.owl#>
SELECT ?class ?label ?description
WHERE {
?class a owl:Class.
OPTIONAL { ?class rdfs:label ?label}
OPTIONAL { ?class rdfs:comment ?description}
}
The description of your issue makes me suspect that you did not load your ontology in Fuseki.
Declaring prefix ont: http://wad.nistorandrei.com/ontology.owl# will not allow you to query the distant ontology.owl file.
You have to create a dataset (in manage datasets -> create dataset)
and add data to it (existing dataset -> upload data or with a SPARQL UPDATE query)
Then only you can query your data.