Jena fuseki owl ontology - semantic-web

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.

Related

How to list all properties on a custom Wikibase instance

I am trying to list all properties created in on a wikibase I installed, using docker-compose, based on this install.
Now, want to list all properties that are available in this wikibase, similar to getting that list available through:
<wikibase.url>wiki/Special:ListProperties
I have also extracted that list through SPARQL with the following SPARQL query:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX schema: <http://schema.org/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT DISTINCT
?property
?propertyType
?propertyLabel
?propertyAltLabel
WHERE {
?property a wikibase:Property ;
rdfs:label ?propertyLabel ;
wikibase:propertyType ?propertyType .
OPTIONAL {?property skos:altLabel ?propertyAltLabel .}
}
Running that SPARQL query is expensive though and I need to run that query often, so I would very much like to get that list of properties to the core wikibase API.
Is that possible?
If you know the namespace number for properties on the target wiki (it’s usually 122 if the wiki has an Item: namespace, or 120 if, like on Wikidata, items are in the main namespace), you can use the core allpages API: https://www.wikidata.org/w/api.php?action=query&list=allpages&apnamespace=120
To also get the labels at the same time, use it as a generator and combine it with the entityterms API (new in 1.35; looks like it’s not documented yet, but see T257658): https://www.wikidata.org/w/api.php?action=query&generator=allpages&gapnamespace=120&prop=entityterms&wbetterms=label

DBPedia-France (fr.dpbedia.org/sparql) query giving different result from a call to another

I'm calling on http://fr.dbpedia.org/sparql
the following SPARQL query:
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 distinct ?lcs where {
{
?lcs ^(rdf:type/rdfs:subClassOf*) <http://fr.dbpedia.org/resource/Honoré_Daumier> ,
<http://fr.dbpedia.org/resource/Auguste_Rodin>;
a owl:Class .
filter not exists {
?llcs ^(rdf:type/rdfs:subClassOf*) <http://fr.dbpedia.org/resource/Honoré_Daumier> ,
<http://fr.dbpedia.org/resource/Auguste_Rodin>;
a owl:Class ;
rdfs:subClassOf+ ?lcs .
}
}
}
On some call I've http://dbpedia.org/ontology/Person as result, on others call I'm getting http://dbpedia.org/ontology/Person and http://dbpedia.org/ontology/Agent and with others the previous answers plus http://www.w3.org/2002/07/owl#Thing
without nothing to know that a response isn't complete. How can I use the result, if it is a little randomized
The main reason for your query not working as expected is that the data the data is i) split into separate graphs and ii) not all graphs were added to the default graph.
To keep it short, the instance data is contained inside the graph http://fr.dbpedia.org whereas the schema triples will be accessible via http://dbpedia.org graph only. Sometimes, if no graph is given, then the union of some graphs is used as the default graph which will be the dataset at query time. Unfortunately, this doesn't hold for the French DBpedia endpoint, only the instance data graph will be used.
You can check this with
DESCRIBE <http://dbpedia.org/ontology/Person>
which is empty when using either no graph explicitly or the graph http://fr.dbpedia.org, but non-empty for graph http://dbpedia.org.
The way to define the default graph is using the keyword FROM. For your query, it should therefore be
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 distinct ?lcs
from <http://fr.dbpedia.org>
from <http://dbpedia.org>
where {
?lcs ^(rdf:type/rdfs:subClassOf*) <http://fr.dbpedia.org/resource/Honoré_Daumier> ,
<http://fr.dbpedia.org/resource/Auguste_Rodin>;
a owl:Class .
filter not exists {
?llcs ^(rdf:type/rdfs:subClassOf*) <http://fr.dbpedia.org/resource/Honoré_Daumier> ,
<http://fr.dbpedia.org/resource/Auguste_Rodin>;
a owl:Class ;
rdfs:subClassOf+ ?lcs .
}
}
Note, while this seems to return the correct result, you should also consider the comment from #TallTed regarding possible differences among language chapters (e.g. English vs French Wikipedia as source), release dumps (2016 vs 2018 or even the DBpedia Live) as well as Virtuoso versions used as backend.

owl:equivalentProperty relations between DBPedia and Yago

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

SPARQL query not retrieving the individuals in protege 5.0

i am working on protege 5.0 tool i downloaded the ontologies i.e doid.owl and cpr.owl which is freely downloadable from the web then i merged them. and i tried querying the ontologies using a SPARQL query the basic "select *" query is working but for retrieving the individuals, i have a query which is not working.. since cpr.owl is the benchmark i merged the ontology into that
the query is:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rs:<http://purl.obolibrary.org/obo/doid.owl>
PREFIX ab: <http://purl.org/cpr/0.9>
SELECT ?name ?age ?address
WHERE
{ ?person ab:hasDisease "heart_cancer";
ab:Name ?name ;
ab:Age ?age ;
ab:Address ?address. }

fuseki doesn't select from dbpedia on my computer

I have fuseki running on my computer. version 1.1.1. but it when I enter a query to select from dbpedia it doesnt return anything. The query made is suppose to return http://dbpedia.org/class/yago/Guitarist110151760 as ?artistKind and http://semanticweb.org/laura/ontologies/2014/9/untitled-ontology-26#Guitar as ?instrument.
I made the ontology in protege and used a restriction that Guitarist110151760 playsInstrument Guitar.
PREFIX instru: <http://www.semanticweb.org/laura/ontologies/2014/9/untitled-ontology-26#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dbpedia: <http://dbpedia.org/resource/>
select ?artistKind ?instrument
FROM <http://www.semanticweb.org/laura/ontologies/2014/9/untitled-ontology-26#>
WHERE
{
?artistKind instru:playsInstrument ?instrument.
SERVICE <http://dbpedia.org/sparql> {
dbpedia:Eric_Clapton rdf:type ?artistKind . }
}
Use website http://dbpedia.org/sparql to perform successful queries on dbpedia ontology because jena fusiki is used to perform queries on local ontologies inside hard disk (by loading owl files)