SPARQL - write a query to get uris refering to DBpedia ontology
up vote
0
down vote
favorite
My current query looks like this:
SELECT DISTINCT ?pred WHERE {
?pred a rdf:Property
}
ORDER BY ?pred
which returns predicates like http://dbpedia.org/ontology/birthYear and http://dbpedia.org/property/abandoned . How may I modify my query in order to get results with the prefix "http://dbpedia.org/ontology/" only?
sparql dbpedia
add a comment |
up vote
0
down vote
favorite
My current query looks like this:
SELECT DISTINCT ?pred WHERE {
?pred a rdf:Property
}
ORDER BY ?pred
which returns predicates like http://dbpedia.org/ontology/birthYear and http://dbpedia.org/property/abandoned . How may I modify my query in order to get results with the prefix "http://dbpedia.org/ontology/" only?
sparql dbpedia
1
SELECT ?pred WHERE { VALUES ?type {owl:ObjectProperty owl:DatatypeProperty} ?pred a ?type } ORDER BY ?pred
– AKSW
Nov 9 at 13:48
1
This query returns e. g.http://www.wikidata.org/entity/P102s
today. It wasn't like this yesterday.
– Stanislav Kralin
Nov 10 at 14:43
@StanislavKralin oh, ok. Didn't touch DBpedia for a while and didn't know that they loaded Wikidata schema. Thanks.
– AKSW
Nov 10 at 16:52
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
My current query looks like this:
SELECT DISTINCT ?pred WHERE {
?pred a rdf:Property
}
ORDER BY ?pred
which returns predicates like http://dbpedia.org/ontology/birthYear and http://dbpedia.org/property/abandoned . How may I modify my query in order to get results with the prefix "http://dbpedia.org/ontology/" only?
sparql dbpedia
My current query looks like this:
SELECT DISTINCT ?pred WHERE {
?pred a rdf:Property
}
ORDER BY ?pred
which returns predicates like http://dbpedia.org/ontology/birthYear and http://dbpedia.org/property/abandoned . How may I modify my query in order to get results with the prefix "http://dbpedia.org/ontology/" only?
sparql dbpedia
sparql dbpedia
asked Nov 9 at 13:12
user6822657
1
SELECT ?pred WHERE { VALUES ?type {owl:ObjectProperty owl:DatatypeProperty} ?pred a ?type } ORDER BY ?pred
– AKSW
Nov 9 at 13:48
1
This query returns e. g.http://www.wikidata.org/entity/P102s
today. It wasn't like this yesterday.
– Stanislav Kralin
Nov 10 at 14:43
@StanislavKralin oh, ok. Didn't touch DBpedia for a while and didn't know that they loaded Wikidata schema. Thanks.
– AKSW
Nov 10 at 16:52
add a comment |
1
SELECT ?pred WHERE { VALUES ?type {owl:ObjectProperty owl:DatatypeProperty} ?pred a ?type } ORDER BY ?pred
– AKSW
Nov 9 at 13:48
1
This query returns e. g.http://www.wikidata.org/entity/P102s
today. It wasn't like this yesterday.
– Stanislav Kralin
Nov 10 at 14:43
@StanislavKralin oh, ok. Didn't touch DBpedia for a while and didn't know that they loaded Wikidata schema. Thanks.
– AKSW
Nov 10 at 16:52
1
1
SELECT ?pred WHERE { VALUES ?type {owl:ObjectProperty owl:DatatypeProperty} ?pred a ?type } ORDER BY ?pred
– AKSW
Nov 9 at 13:48
SELECT ?pred WHERE { VALUES ?type {owl:ObjectProperty owl:DatatypeProperty} ?pred a ?type } ORDER BY ?pred
– AKSW
Nov 9 at 13:48
1
1
This query returns e. g.
http://www.wikidata.org/entity/P102s
today. It wasn't like this yesterday.– Stanislav Kralin
Nov 10 at 14:43
This query returns e. g.
http://www.wikidata.org/entity/P102s
today. It wasn't like this yesterday.– Stanislav Kralin
Nov 10 at 14:43
@StanislavKralin oh, ok. Didn't touch DBpedia for a while and didn't know that they loaded Wikidata schema. Thanks.
– AKSW
Nov 10 at 16:52
@StanislavKralin oh, ok. Didn't touch DBpedia for a while and didn't know that they loaded Wikidata schema. Thanks.
– AKSW
Nov 10 at 16:52
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
@AKSW provided one possible solution in comments, which may indeed get you what you want --
SELECT ?pred
WHERE
{ VALUES ?type {owl:ObjectProperty owl:DatatypeProperty }
?pred a ?type
}
ORDER BY ?pred
That said, your question was specific in a way not answered by the above, so possibly this might be what you want --
SELECT ?pred
WHERE
{
?pred a rdf:Property
FILTER ( REGEX ( STR (?pred), "http://dbpedia.org/ontology/", "i" ) )
}
ORDER BY ?pred
I'd even go forstrstarts
function in case of namespace comparison - some triple stores might make use more efficient string checks with it (I know, probably none will do this). Regarding my suggestion, that will cover all mapping based properties, i.e. those withhttp://dbpedia.org/ontology/
– AKSW
Nov 10 at 9:54
As of 2018-11-10, one could also trySELECT DISTINCT ?pred { ?pred a rdf:Property . ?pred rdfs:isDefinedBy <http://dbpedia.org/ontology/> }
or evenSELECT DISTINCT ?pred FROM <http://dbpedia.org/resource/classes#> { ?pred a rdf:Property }
– Stanislav Kralin
Nov 10 at 14:44
@StanislavKralin is there a new version now or why those changes? By the way,DISTINCT
shouldn't be necessary for those queries. And the last query indeed returns all properties, so we would have to apply the namespace filter
– AKSW
Nov 10 at 16:56
@AKSW, the second query could be rather this
– Stanislav Kralin
Nov 10 at 17:02
1
@StanislavKralin I see, in the first query you have the union of the default graphhttp://dbpedia.org
and the graphhttp://dbpedia.org/resource/classes#
- that's why the duplicates occur. Clearly, this only holds for the Web UI - in a client the default graph isn't defined by default.
– AKSW
Nov 10 at 17:40
|
show 2 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53226368%2fsparql-write-a-query-to-get-uris-refering-to-dbpedia-ontology%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
@AKSW provided one possible solution in comments, which may indeed get you what you want --
SELECT ?pred
WHERE
{ VALUES ?type {owl:ObjectProperty owl:DatatypeProperty }
?pred a ?type
}
ORDER BY ?pred
That said, your question was specific in a way not answered by the above, so possibly this might be what you want --
SELECT ?pred
WHERE
{
?pred a rdf:Property
FILTER ( REGEX ( STR (?pred), "http://dbpedia.org/ontology/", "i" ) )
}
ORDER BY ?pred
I'd even go forstrstarts
function in case of namespace comparison - some triple stores might make use more efficient string checks with it (I know, probably none will do this). Regarding my suggestion, that will cover all mapping based properties, i.e. those withhttp://dbpedia.org/ontology/
– AKSW
Nov 10 at 9:54
As of 2018-11-10, one could also trySELECT DISTINCT ?pred { ?pred a rdf:Property . ?pred rdfs:isDefinedBy <http://dbpedia.org/ontology/> }
or evenSELECT DISTINCT ?pred FROM <http://dbpedia.org/resource/classes#> { ?pred a rdf:Property }
– Stanislav Kralin
Nov 10 at 14:44
@StanislavKralin is there a new version now or why those changes? By the way,DISTINCT
shouldn't be necessary for those queries. And the last query indeed returns all properties, so we would have to apply the namespace filter
– AKSW
Nov 10 at 16:56
@AKSW, the second query could be rather this
– Stanislav Kralin
Nov 10 at 17:02
1
@StanislavKralin I see, in the first query you have the union of the default graphhttp://dbpedia.org
and the graphhttp://dbpedia.org/resource/classes#
- that's why the duplicates occur. Clearly, this only holds for the Web UI - in a client the default graph isn't defined by default.
– AKSW
Nov 10 at 17:40
|
show 2 more comments
up vote
2
down vote
accepted
@AKSW provided one possible solution in comments, which may indeed get you what you want --
SELECT ?pred
WHERE
{ VALUES ?type {owl:ObjectProperty owl:DatatypeProperty }
?pred a ?type
}
ORDER BY ?pred
That said, your question was specific in a way not answered by the above, so possibly this might be what you want --
SELECT ?pred
WHERE
{
?pred a rdf:Property
FILTER ( REGEX ( STR (?pred), "http://dbpedia.org/ontology/", "i" ) )
}
ORDER BY ?pred
I'd even go forstrstarts
function in case of namespace comparison - some triple stores might make use more efficient string checks with it (I know, probably none will do this). Regarding my suggestion, that will cover all mapping based properties, i.e. those withhttp://dbpedia.org/ontology/
– AKSW
Nov 10 at 9:54
As of 2018-11-10, one could also trySELECT DISTINCT ?pred { ?pred a rdf:Property . ?pred rdfs:isDefinedBy <http://dbpedia.org/ontology/> }
or evenSELECT DISTINCT ?pred FROM <http://dbpedia.org/resource/classes#> { ?pred a rdf:Property }
– Stanislav Kralin
Nov 10 at 14:44
@StanislavKralin is there a new version now or why those changes? By the way,DISTINCT
shouldn't be necessary for those queries. And the last query indeed returns all properties, so we would have to apply the namespace filter
– AKSW
Nov 10 at 16:56
@AKSW, the second query could be rather this
– Stanislav Kralin
Nov 10 at 17:02
1
@StanislavKralin I see, in the first query you have the union of the default graphhttp://dbpedia.org
and the graphhttp://dbpedia.org/resource/classes#
- that's why the duplicates occur. Clearly, this only holds for the Web UI - in a client the default graph isn't defined by default.
– AKSW
Nov 10 at 17:40
|
show 2 more comments
up vote
2
down vote
accepted
up vote
2
down vote
accepted
@AKSW provided one possible solution in comments, which may indeed get you what you want --
SELECT ?pred
WHERE
{ VALUES ?type {owl:ObjectProperty owl:DatatypeProperty }
?pred a ?type
}
ORDER BY ?pred
That said, your question was specific in a way not answered by the above, so possibly this might be what you want --
SELECT ?pred
WHERE
{
?pred a rdf:Property
FILTER ( REGEX ( STR (?pred), "http://dbpedia.org/ontology/", "i" ) )
}
ORDER BY ?pred
@AKSW provided one possible solution in comments, which may indeed get you what you want --
SELECT ?pred
WHERE
{ VALUES ?type {owl:ObjectProperty owl:DatatypeProperty }
?pred a ?type
}
ORDER BY ?pred
That said, your question was specific in a way not answered by the above, so possibly this might be what you want --
SELECT ?pred
WHERE
{
?pred a rdf:Property
FILTER ( REGEX ( STR (?pred), "http://dbpedia.org/ontology/", "i" ) )
}
ORDER BY ?pred
answered Nov 9 at 21:53
TallTed
5,91521327
5,91521327
I'd even go forstrstarts
function in case of namespace comparison - some triple stores might make use more efficient string checks with it (I know, probably none will do this). Regarding my suggestion, that will cover all mapping based properties, i.e. those withhttp://dbpedia.org/ontology/
– AKSW
Nov 10 at 9:54
As of 2018-11-10, one could also trySELECT DISTINCT ?pred { ?pred a rdf:Property . ?pred rdfs:isDefinedBy <http://dbpedia.org/ontology/> }
or evenSELECT DISTINCT ?pred FROM <http://dbpedia.org/resource/classes#> { ?pred a rdf:Property }
– Stanislav Kralin
Nov 10 at 14:44
@StanislavKralin is there a new version now or why those changes? By the way,DISTINCT
shouldn't be necessary for those queries. And the last query indeed returns all properties, so we would have to apply the namespace filter
– AKSW
Nov 10 at 16:56
@AKSW, the second query could be rather this
– Stanislav Kralin
Nov 10 at 17:02
1
@StanislavKralin I see, in the first query you have the union of the default graphhttp://dbpedia.org
and the graphhttp://dbpedia.org/resource/classes#
- that's why the duplicates occur. Clearly, this only holds for the Web UI - in a client the default graph isn't defined by default.
– AKSW
Nov 10 at 17:40
|
show 2 more comments
I'd even go forstrstarts
function in case of namespace comparison - some triple stores might make use more efficient string checks with it (I know, probably none will do this). Regarding my suggestion, that will cover all mapping based properties, i.e. those withhttp://dbpedia.org/ontology/
– AKSW
Nov 10 at 9:54
As of 2018-11-10, one could also trySELECT DISTINCT ?pred { ?pred a rdf:Property . ?pred rdfs:isDefinedBy <http://dbpedia.org/ontology/> }
or evenSELECT DISTINCT ?pred FROM <http://dbpedia.org/resource/classes#> { ?pred a rdf:Property }
– Stanislav Kralin
Nov 10 at 14:44
@StanislavKralin is there a new version now or why those changes? By the way,DISTINCT
shouldn't be necessary for those queries. And the last query indeed returns all properties, so we would have to apply the namespace filter
– AKSW
Nov 10 at 16:56
@AKSW, the second query could be rather this
– Stanislav Kralin
Nov 10 at 17:02
1
@StanislavKralin I see, in the first query you have the union of the default graphhttp://dbpedia.org
and the graphhttp://dbpedia.org/resource/classes#
- that's why the duplicates occur. Clearly, this only holds for the Web UI - in a client the default graph isn't defined by default.
– AKSW
Nov 10 at 17:40
I'd even go for
strstarts
function in case of namespace comparison - some triple stores might make use more efficient string checks with it (I know, probably none will do this). Regarding my suggestion, that will cover all mapping based properties, i.e. those with http://dbpedia.org/ontology/
– AKSW
Nov 10 at 9:54
I'd even go for
strstarts
function in case of namespace comparison - some triple stores might make use more efficient string checks with it (I know, probably none will do this). Regarding my suggestion, that will cover all mapping based properties, i.e. those with http://dbpedia.org/ontology/
– AKSW
Nov 10 at 9:54
As of 2018-11-10, one could also try
SELECT DISTINCT ?pred { ?pred a rdf:Property . ?pred rdfs:isDefinedBy <http://dbpedia.org/ontology/> }
or even SELECT DISTINCT ?pred FROM <http://dbpedia.org/resource/classes#> { ?pred a rdf:Property }
– Stanislav Kralin
Nov 10 at 14:44
As of 2018-11-10, one could also try
SELECT DISTINCT ?pred { ?pred a rdf:Property . ?pred rdfs:isDefinedBy <http://dbpedia.org/ontology/> }
or even SELECT DISTINCT ?pred FROM <http://dbpedia.org/resource/classes#> { ?pred a rdf:Property }
– Stanislav Kralin
Nov 10 at 14:44
@StanislavKralin is there a new version now or why those changes? By the way,
DISTINCT
shouldn't be necessary for those queries. And the last query indeed returns all properties, so we would have to apply the namespace filter– AKSW
Nov 10 at 16:56
@StanislavKralin is there a new version now or why those changes? By the way,
DISTINCT
shouldn't be necessary for those queries. And the last query indeed returns all properties, so we would have to apply the namespace filter– AKSW
Nov 10 at 16:56
@AKSW, the second query could be rather this
– Stanislav Kralin
Nov 10 at 17:02
@AKSW, the second query could be rather this
– Stanislav Kralin
Nov 10 at 17:02
1
1
@StanislavKralin I see, in the first query you have the union of the default graph
http://dbpedia.org
and the graph http://dbpedia.org/resource/classes#
- that's why the duplicates occur. Clearly, this only holds for the Web UI - in a client the default graph isn't defined by default.– AKSW
Nov 10 at 17:40
@StanislavKralin I see, in the first query you have the union of the default graph
http://dbpedia.org
and the graph http://dbpedia.org/resource/classes#
- that's why the duplicates occur. Clearly, this only holds for the Web UI - in a client the default graph isn't defined by default.– AKSW
Nov 10 at 17:40
|
show 2 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53226368%2fsparql-write-a-query-to-get-uris-refering-to-dbpedia-ontology%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
SELECT ?pred WHERE { VALUES ?type {owl:ObjectProperty owl:DatatypeProperty} ?pred a ?type } ORDER BY ?pred
– AKSW
Nov 9 at 13:48
1
This query returns e. g.
http://www.wikidata.org/entity/P102s
today. It wasn't like this yesterday.– Stanislav Kralin
Nov 10 at 14:43
@StanislavKralin oh, ok. Didn't touch DBpedia for a while and didn't know that they loaded Wikidata schema. Thanks.
– AKSW
Nov 10 at 16:52