-3

This is my SPARQL query and its not working on dbpedia.org

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 xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX uni: http://www.semanticweb.org/admin/ontologies/2017/4/untitled ontology-19#
SELECT ?property ?subject ?prop ?object 
    WHERE {
               uni:Product ?property ?subject .
                  OPTIONAL {
                               ?subject ?prop ?object
                           }
          }
alessandrio
  • 4,282
  • 2
  • 29
  • 40
  • 3
    You haven't actually asked a question. You haven't even told us what the problem is (hint: "it's not working" is not a problem description). Try and describe what you expected this query to do, and what it actually did instead. – Jeen Broekstra May 26 '17 at 10:25
  • 1
    The information "Not working" is **not** helpful! Please learn how to ask questions here on Stackoverflow! And please learn to use the Markdown formatting! – UninformedUser May 26 '17 at 10:42
  • 1
    An addition, you really should start with an RDF tutorial. And then a SPARQL tutorial. – UninformedUser May 26 '17 at 10:42
  • 1
    And finally, DBpedia contains mostly the information from the Wikipedia infoboxes. So tell me, why do you think that it contains entities from your local ontology? – UninformedUser May 26 '17 at 10:44

2 Answers2

0

Your syntax is illegal. I "fixed" it by replacing an illegal whitespace character in your uni: definition with an underscore. Not surprisingly, the modified query runs but returns 0 results.

Are you sure there are entities at DBpedia with any path even remotely like <http://www.semanticweb.org/admin/ontologies/2017/4/untitled_ontology-19#>? Are you trying to query data that you created, or data that is part of the public DBpedia data set? If you created the entities starting with <http://www.semanticweb.org/admin/ontologies/2017/4/untitled_ontology-19#>, they're not going to be available at the DBpedia SPARQL endpoint.

# all prefix expansions were missing angle brackets
PREFIX  xsd:  <http://www.w3.org/2001/XMLSchema#>
# replaced whitespace with underscore
PREFIX  uni:  <http://www.semanticweb.org/admin/ontologies/2017/4/untitled_ontology-19#>
PREFIX  rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX  owl:  <http://www.w3.org/2002/07/owl#>

SELECT  ?property ?subject ?prop ?object
WHERE
  { uni:Product  ?property  ?subject
    OPTIONAL
      { ?subject  ?prop  ?object }
  }
Mark Miller
  • 3,011
  • 1
  • 14
  • 34
0

As Mark says, first the illegal characters in your query prevent it from functioning. Second if you created the data under <http://www.semanticweb.org/admin/ontologies/2017/4/untitled_ontology-19#>, it will not be available in DBpedia. If you are willing to integrate results from both <http://www.semanticweb.org/admin/ontologies/2017/4/untitled_ontology-19#> and DBpedia, you have two options:

  1. If the resource uni:Product has a URI at DBpedia, use it.
  2. If you have a local SPARQL endpoint for your data, you can use a SPARQL SERVICE QUERY to access multiple datasets via their endpoints.
Median Hilal
  • 1,483
  • 9
  • 17