Advertisement
asanchez75

Virtuoso/queries/transitive

Mar 31st, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1.  
  2. SELECT COUNT(DISTINCT ?instance2) FROM <http://dbpedia.org> {
  3. ?instance2 rdf:type/rdfs:subClassOf* ?class2.
  4. FILTER (?class2 = <http://dbpedia.org/ontology/Place>)
  5. }
  6. ============================================================================================================
  7. SELECT COUNT(DISTINCT ?instance2) FROM <http://dbpedia.org> {
  8. ?subclass rdfs:subClassOf* ?class2.
  9. ?instance2 rdf:type ?subclass.
  10. FILTER (?class2 = <http://dbpedia.org/ontology/Place>)
  11. }
  12.  
  13. ============================================================================================================
  14.  
  15.  
  16. SELECT ?classuri (COUNT(DISTINCT ?instance) AS ?total) WHERE
  17. { GRAPH <http://xlore.org> {
  18. ?subclass owl:SubClassOf ?classuri OPTION (TRANSITIVE, T_DISTINCT,T_NO_CYCLES, T_MIN(0)).
  19. ?instance owl:InstanceOf ?subclass.
  20. FILTER (?classuri = <http://xlore.org/concept/375>)
  21. }}
  22. LIMIT 10
  23.  
  24. SELECT ?s {
  25. ?s rdfs:subClassOf ?o OPTION (TRANSITIVE, T_IN(?s), T_OUT(?o), T_DISTINCT,T_NO_CYCLES, T_MIN(0)).
  26. FILTER(?o = <http://dbpedia.org/ontology/MotorsportRacer>)
  27. }
  28.  
  29. ========================================================================================================================
  30.  
  31. Results: DBpedia interlinking, Query improvement, Wikidata
  32. https://github.com/nicolas-fricke/semmul2014/wiki/Results:-DBpedia-interlinking,-Query-improvement,-Wikidata
  33. ========================================================================================================================
  34.  
  35. ARQ - Property Paths¶
  36. https://jena.apache.org/documentation/query/property_paths.html
  37. Some forms of limited inference are possible as well. For example: all types and supertypes of a resource:
  38.  
  39. { <http://example/> rdf:type/rdfs:subClassOf* ?type }
  40. ========================================================================================================================
  41.  
  42. Combine multiple sets of rows in SPARQL
  43. http://stackoverflow.com/questions/11026790/combine-multiple-sets-of-rows-in-sparql
  44.  
  45. SELECT (COUNT(?s) AS ?distinct)
  46. ?propset
  47. (group_concat(?count; separator = \"\\t\") AS ?counts)
  48. {
  49. SELECT ?s
  50. (group_concat(?p; separator = \" \") AS ?propset)
  51. (group_concat(?c; separator = \" \") AS ?count
  52. {
  53. ?s ?p ?c
  54. } GROUP BY ?s ORDER BY ?s
  55. } GROUP BY ?propset ORDER BY ?propset
  56.  
  57. ========================================================================================================================
  58. How to eleminate redundancy from My Sparql Query against DBPedia End Point ?
  59. http://answers.semanticweb.com/questions/11804/how-to-eleminate-redundancy-from-my-sparql-query-against-dbpedia-end-point
  60.  
  61. PREFIX db: <http://dbpedia.org/ontology/>
  62. PREFIX property: <http://dbpedia.org/property/>
  63. PREFIX position:<http://www.w3.org/2003/01/geo/wgs84_pos#>
  64. SELECT ?CompanyName (sql:SAMPLE(?Company_Name) AS ?Name) (sql:SAMPLE(?Foundation_URI) AS ?Foundation_URI)
  65. (sql:SAMPLE(?Website) AS ?Website) (sql:SAMPLE(?LocationCity) AS ?Location)
  66. (sql:SAMPLE(?Foundation_Name) AS ?Foundation_Name) (sql:SAMPLE(?Latitude) AS ?Latitude)
  67. (sql:SAMPLE(?Longitude) AS ?Longitude) (sql:SAMPLE(?Population) AS ?Population)
  68. WHERE
  69. {
  70. ?CompanyName a db:Company .
  71. ?CompanyName property:name ?Company_Name .
  72. ?CompanyName db:foundationPlace ?Foundation_URI .
  73. ?CompanyName db:wikiPageExternalLink ?Website .
  74. ?CompanyName db:locationCity ?LocationCity .
  75. ?Foundation_URI property:name ?Foundation_Name .
  76. ?Foundation_URI position:lat ?Latitude .
  77. ?Foundation_URI position:long ?Longitude .
  78. OPTIONAL{ ?Foundation_URI property:populationCensus ?Population. }
  79. }
  80. GROUP BY ?CompanyName
  81.  
  82. ========================================================================================================================
  83. How to get unique results from SPARQL query
  84. http://answers.semanticweb.com/questions/11859/how-to-get-unique-results-from-sparql-query
  85. ========================================================================================================================
  86. Filter partial URI with SPARQL (STRSTARTS)
  87. http://answers.semanticweb.com/questions/10207/filter-partial-uri-with-sparql
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement