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?










share|improve this question


















  • 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















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?










share|improve this question


















  • 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













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?










share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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














  • 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












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





share|improve this answer





















  • 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












  • @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 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













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
});


}
});














draft saved

draft discarded


















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





share|improve this answer





















  • 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












  • @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 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

















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





share|improve this answer





















  • 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












  • @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 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















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





share|improve this answer












@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






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 9 at 21:53









TallTed

5,91521327




5,91521327












  • 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












  • @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 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




















  • 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












  • @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 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


















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




















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()