Regarding SPARQL queries on DBPedia SPARQL end point in a loop - sparql

while((reader=br.readLine())!=null)
{
System.out.println(reader);
type="";
String queryNew="select ?y ?z where {"+reader+" <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z . }";
Query query=QueryFactory.create(queryNew);
ARQ.getContext().setTrue(ARQ.useSAX);
QueryExecution qexec = QueryExecutionFactory.sparqlService("http://dbpedia.org/sparql", query);
ResultSet results = qexec.execSelect();
while(results.hasNext())
{
QuerySolution soln=results.nextSolution();
type=type+" "+soln.get("?z");
System.out.println(soln.get("?y")+" "+soln.get("?z"));
}
bw.write(reader+" "+type+"\n");
}
From a file I am reading actor names and then trying to get all the rdf:type links for each actor. While the result prints for the first actor, the rest of the execution gets stuck. The 'reader' is nothing but an actor's name which is the dbpedia resource. Can anyone kindly tell me what might have gone wrong in the code?

You don't show your data, but assuming that the file contains simply the names of actors, as you say, then the query you're actually asking is something like:
select ?y ?z where {
"Matt Damon" rdf:type ?z
}
That's never going to return any results, because the subject of an RDF triple is always an RDF resource, not a string literal.
You should change your query to:
prefix dbpprop: <http://dbpedia.org/property/>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
select ?actor ?type where {
?actor dbpprop:name "Matt Damon"#en ;
rdf:type ?type
}
in other words "what are the rdf:types of the resource whose name (in English) is Matt Damon?"

As Ian Dickinson pointed out in his answer, you haven't shown us the data, nor what exactly the value of reader is, so it's hard to tell exactly what's going wrong. It does sound like you need to adjust your query to something along the lines of
?actor rdfs:label ?label
where ?label is the name of the actor that you're interested in. If you use string concatenation like you did in
String queryNew = "select ?y ?z where {" + reader + " <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z . }";
you're opening yourself up to SPARQL injection attacks. E.g., what would happen if reader contains more SPARQL query text? (Also, because rdf:type is so commonly used, SPARQL actually allows you to abbreviate it with a, as in ?actor a dbpedia-owl:Person.) To avoid this sort of issue, Jena provides a ParameterizedSparqlString that will take care of proper escaping. Also note that RDF distinguishes between plain literals, e.g., "Richard Dreyfuss" and language tagged strings, e.g., "Richard Dreyfuss"#en. This means that you might want to include language tags in your query. Finally, note that there might well be more than one thing in DBpedia with a given label. Heres's code using a parameterized SPARQL string that finds resources with the label "Richard Dreyfuss"#en, along with all of their RDF types:
import com.hp.hpl.jena.query.ParameterizedSparqlString;
import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.query.ResultSetFormatter;
import com.hp.hpl.jena.rdf.model.Literal;
import com.hp.hpl.jena.rdf.model.ResourceFactory;
public class DBpediaQueryExample {
public static void main(String[] args) {
/*
* A typed literal: the name Richard Dreyfuss in English. In SPARQL
* this is written as "Richard Dreyfuss"#en.
*/
final Literal richardDreyfuss = ResourceFactory.createLangLiteral( "Richard Dreyfuss", "en" );
/*
* A parameterized SPARQL string for the query. Using this, along with
* the various setZZZ(...) methods can prevent some SPARQL injection
* attacks by doing proper escaping.
*/
final ParameterizedSparqlString queryString = new ParameterizedSparqlString(
"prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n" +
"\n" +
"select ?resource ?type where {\n" +
" ?resource a ?type ;\n" +
" rdfs:label ?label .\n" +
"}" );
/*
* Fill in "Richard Dreyfuss"#en for the ?label.
*/
queryString.setLiteral("label", richardDreyfuss );
/*
* Get a query execution that will run against the DBpedia SPARQL
* endpoint, and will use the parameterized query.
*/
final QueryExecution exec = QueryExecutionFactory.sparqlService(
"http://dbpedia.org/sparql",
queryString.asQuery() );
/*
* Execute the query to produce a result set, and format it nicely.
*/
final ResultSet results = exec.execSelect();
ResultSetFormatter.out( results );
}
}
-------------------------------------------------------------------------------------------------------------------------------------------------
| resource | type |
=================================================================================================================================================
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://www.w3.org/2002/07/owl#Thing> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/ActorsFromLosAngeles,California> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/AmericanFilmActors> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/AmericanTelevisionActors> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/ontology/Agent> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/ontology/Person> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://umbel.org/umbel/rc/Actor> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://schema.org/Person> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://xmlns.com/foaf/0.1/Person> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/AmericanComedians> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/Comedian109940146> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/JewishActors> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/PeopleFromBrooklyn> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/Adult109605289> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/Communicator109610660> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/LivingPeople> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/Object100002684> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/PeopleWithBipolarDisorder> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/Person100007846> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/Whole100003553> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/YagoLegalActor> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/Entertainer109616922> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/AlternateHistoryWriters> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/Actor109765278> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/AmericanConscientiousObjectors> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/AmericanHistoricalNovelists> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/ConscientiousObjector109957013> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/Dissenter110018021> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/Novelist110363573> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/Performer110415638> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/Writer110794014> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/CausalAgent100007347> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/LivingThing100004258> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/Organism100004475> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/JewishComedians> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/JewishPacifists> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/Pacifist110390199> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/PhysicalEntity100001930> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/YagoLegalActorGeo> |
| <http://dbpedia.org/resource/Richard_Dreyfuss> | <http://dbpedia.org/class/yago/PeopleFromQueens> |
| <http://sw.opencyc.org/2008/06/10/concept/en/RichardDreyfuss> | <http://sw.opencyc.org/2008/06/10/concept/en/ActorInMovies> |
| <http://sw.opencyc.org/2008/06/10/concept/en/RichardDreyfuss> | <http://sw.opencyc.org/2008/06/10/concept/en/MaleHuman> |
| <http://sw.opencyc.org/2008/06/10/concept/Mx4rwOREVpwpEbGdrcN5Y29ycA> | <http://sw.opencyc.org/2008/06/10/concept/Mx4rvVjWoZwpEbGdrcN5Y29ycA> |
| <http://sw.opencyc.org/2008/06/10/concept/Mx4rwOREVpwpEbGdrcN5Y29ycA> | <http://sw.opencyc.org/2008/06/10/concept/Mx4rwMRyTJwpEbGdrcN5Y29ycA> |
-------------------------------------------------------------------------------------------------------------------------------------------------

Related

See sparql with specific information

I want to visualize everything (well not all only those attributes) concerning the area to be called, without the filter all are displayed and even information that I do not consider relevant, so I only want to see those attributes (predicates).
It's not even hard for me to understand sparql and I have to show results now !! so thanks in advance
Query
PREFIX dco: <http://192.168.1.10:8890/task/ontology/>
PREFIX dcr: <http://192.168.1.10:8890/digcomp/resource/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select * where {
?Sujeto ?Predicado ?Objeto .
?Sujeto rdf:type dco:Areas .
FILTER (?Objeto="Information and data literacy")
}
Result
| Subject | Predicate | Object |
| ------------- |:-------------:| -----:|
| dcr:areas/1 | rdfs:label | "Information and data literacy" |
Desired result
| Subject | Predicate | Object |
| ------------- |:-------------:| -----:|
| dcr:areas/1 | rdf:type | dco:Areas |
| dcr:areas/1 | rdfs:label | "Information and data literacy" |
| dcr:areas/1 | dcr:name_area | "Information and data literacy"|

Column result unexpectedly returning nothing

Have a SPARQL query that returns nothing for Airport_Name when I believe it should.
PREFIX nas: <https://data.nasa.gov/ontologies/atmonto/NAS#>
PREFIX gen: <https://data.nasa.gov/ontologies/atmonto/general#>
SELECT *
WHERE{
{
{SELECT ?Airport_Name{
?Airport rdf:type nas:Airport ;
nas:airportName ?Airport_Name .
}
}
}UNION{
?Location rdf:type gen:PointLocation;
gen:longitude ?X ;
gen:latitude ?Y .
}
?Location rdf:type gen:PointLocation;
gen:longitude ?X ;
gen:latitude ?Y .
FILTER (?X > -80 && ?X < -64 && ?Y > 18 && ?Y < 32)
}
Expected result should return Location, X, Y, and Airport_Name
When I try to return Airport_Name at the bottom, the Location columns then appear blank, so im not sure what has been done wrongly. If anyone could point me in the right direction, that would be much appreciated.
Your query has several issues, the correct query would be something like below.
Query
SELECT *
WHERE
{ ?airport rdf:type/rdfs:subClassOf* nas:Airport ;
nas:airportName ?Airport_Name ;
nas:airportLocation ?location .
?location gen:longitude ?X ;
gen:latitude ?Y
FILTER ( ?X > "-80"^^xsd:float && ?X < "-64"^^xsd:float && ?Y > "18"^^xsd:float && ?Y < "32"^^xsd:float )
}
Result (sample with LIMIT 10)
--------------------------------------------------------------------------------------------------------------------------
| airport | Airport_Name | location | X | Y |
==========================================================================================================================
| nas:MYEMairport | "Governors Harbour" | nas:MYEMcoordinates | "-76.330178"^^xsd:float | "25.283586"^^xsd:float |
| nas:MDPCairport | "Punta Cana Intl" | nas:MDPCcoordinates | "-68.366186"^^xsd:float | "18.570781"^^xsd:float |
| nas:MUGTairport | "Mariana Grajales" | nas:MUGTcoordinates | "-75.158333"^^xsd:float | "20.085278"^^xsd:float |
| nas:MDSTairport | "Cibao Intl" | nas:MDSTcoordinates | "-70.604689"^^xsd:float | "19.406092"^^xsd:float |
| nas:MYLSairport | "Stella Maris" | nas:MYLScoordinates | "-75.268778"^^xsd:float | "23.583047"^^xsd:float |
| nas:MBNCairport | "North Caicos" | nas:MBNCcoordinates | "-71.939658"^^xsd:float | "21.917486"^^xsd:float |
| nas:MUMOairport | "Orestes Acosta" | nas:MUMOcoordinates | "-74.922222"^^xsd:float | "20.653889"^^xsd:float |
| nas:MYRPairport | "New Port Nelson" | nas:MYRPcoordinates | "-74.836186"^^xsd:float | "23.684378"^^xsd:float |
| nas:MYEGairport | "George Town" | nas:MYEGcoordinates | "-75.781670"^^xsd:float | "23.466667"^^xsd:float |
| nas:MUBYairport | "Carlos Manuel De Cespedes" | nas:MUBYcoordinates | "-76.621389"^^xsd:float | "20.396389"^^xsd:float |
--------------------------------------------------------------------------------------------------------------------------
Note, the query uses the property path rdf:type/rdfs:subClassOf* which only works if you've also loaded the ontology (NAS.ttl). The property path is necessary because the instance data (airportInst.ttl) uses subclasses of nas:Airport like nas:InternationAirport or nas:CanadianAirport.

How to get grand total in a sparql group by query

I follow up on query where the schema.org database is used to find the number of children of a class. The answer gives for each class the number of children. In my application I need the grand total of all children (i.e. the sum of the counts for each group) in order to compute for each group the percentage of the total number of children.
The query I got from the previous question is:
prefix schema: <http://schema.org/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select ?child (count(?grandchild) as ?nGrandchildren)
from <http://localhost:3030/testDB/data/schemaOrg>
where {
?child rdfs:subClassOf schema:Event .
optional {
?grandchild rdfs:subClassOf ?child
}
} group by ?child
which gives the expected answer (events and number of children).
How to get the total number?
I tried a nested query as:
prefix schema: <http://schema.org/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select ?child (count(?grandchild) as ?nGrandchildren)
from <http://localhost:3030/testDB/data/schemaOrg>
where {
select (count(?grandchild) as ?grandTotal)
{?child rdfs:subClassOf schema:Event .
optional {
?grandchild rdfs:subClassOf ?child
}
}
} group by ?child
but got a single answer: " " -> 0.
This query uses two sub-SELECTs:
* the first computes the number of grandchildren per child
* the second returns the total number of grandchildren
prefix schema: <http://schema.org/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select ?child ?nGrandchildren
(round(?nGrandchildren/?totalGrandchildren * 100) as ?percentageGrandchildren) {
# compute number per child
{
select ?child (count(?grandchild) as ?nGrandchildren) where {
?child rdfs:subClassOf schema:Event .
optional {
?grandchild rdfs:subClassOf ?child
}
}
group by ?child
}
# compute total number
{
select (count(?grandchild) as ?totalGrandchildren) where {
?child rdfs:subClassOf schema:Event .
optional {
?grandchild rdfs:subClassOf ?child
}
}
}
}
Output
-----------------------------------------------------------------------------------------------
| child | nGrandchildren | percentageGrandchildren |
===============================================================================================
| schema:UserInteraction | 9 | "82"^^<http://www.w3.org/2001/XMLSchema#decimal> |
| schema:FoodEvent | 0 | "0"^^<http://www.w3.org/2001/XMLSchema#decimal> |
| schema:MusicEvent | 0 | "0"^^<http://www.w3.org/2001/XMLSchema#decimal> |
| schema:PublicationEvent | 2 | "18"^^<http://www.w3.org/2001/XMLSchema#decimal> |
| schema:LiteraryEvent | 0 | "0"^^<http://www.w3.org/2001/XMLSchema#decimal> |
| schema:SportsEvent | 0 | "0"^^<http://www.w3.org/2001/XMLSchema#decimal> |
| schema:DanceEvent | 0 | "0"^^<http://www.w3.org/2001/XMLSchema#decimal> |
| schema:ScreeningEvent | 0 | "0"^^<http://www.w3.org/2001/XMLSchema#decimal> |
| schema:DeliveryEvent | 0 | "0"^^<http://www.w3.org/2001/XMLSchema#decimal> |
| schema:ExhibitionEvent | 0 | "0"^^<http://www.w3.org/2001/XMLSchema#decimal> |
| schema:EducationEvent | 0 | "0"^^<http://www.w3.org/2001/XMLSchema#decimal> |
| schema:SaleEvent | 0 | "0"^^<http://www.w3.org/2001/XMLSchema#decimal> |
| schema:VisualArtsEvent | 0 | "0"^^<http://www.w3.org/2001/XMLSchema#decimal> |
| schema:CourseInstance | 0 | "0"^^<http://www.w3.org/2001/XMLSchema#decimal> |
| schema:ChildrensEvent | 0 | "0"^^<http://www.w3.org/2001/XMLSchema#decimal> |
| schema:BusinessEvent | 0 | "0"^^<http://www.w3.org/2001/XMLSchema#decimal> |
| schema:Festival | 0 | "0"^^<http://www.w3.org/2001/XMLSchema#decimal> |
| schema:ComedyEvent | 0 | "0"^^<http://www.w3.org/2001/XMLSchema#decimal> |
| schema:TheaterEvent | 0 | "0"^^<http://www.w3.org/2001/XMLSchema#decimal> |
| schema:SocialEvent | 0 | "0"^^<http://www.w3.org/2001/XMLSchema#decimal> |
-----------------------------------------------------------------------------------------------

Selecting Food Calories from SPARQL

I've started looking into SPARQL and I admit I find it very obscure and difficult.
I need to output the calories for all the foods.
I don't really understand the difference between the wd: wdt: p: and ps:
Similarly I am unclear on when to use P000 or Q000 ?
The best I got so far is:
SELECT ?food ?calories ?foodLabel ?caloriesLabel WHERE {
?food wdt:P31 wd:Q2095.
?food wdt:P31 ?calories.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Which gives : Results
Any suggestion would be welcome
If you are willing to download a 1 GB RDF file and publish it at your own triplestore, this looks promising:
https://datahub.io/dataset/open-food-facts
Specifically, http://en.openfoodfacts.org/data/en.openfoodfacts.org.products.rdf (If English is your preferred languague.)
I say download and publish as Googling suggests these data aren't already exposed at any public endpoint.
You will likely have to use different classes and predicates, compared to WikiData.
Hey, this is pretty neat!
SELECT *
WHERE
{ GRAPH <http://openfoodfacts.org>
{ ?s a <http://data.lirmm.fr/ontologies/food#FoodProduct> ;
<http://data.lirmm.fr/ontologies/food#name> ?fn ;
<http://data.lirmm.fr/ontologies/food#energyPer100g> ?energy
}
}
LIMIT 9
gives
+------------------------------------------------------------------------------------------------------+---------------------------------------------+--------+
| s | fn | energy |
+------------------------------------------------------------------------------------------------------+---------------------------------------------+--------+
| http://world-en.openfoodfacts.org/product/9400547030446/heinz-big-n-chunky-chicken-corn | "Heinz Big'n Chunky Chicken & Corn" | "245" |
| http://world-en.openfoodfacts.org/product/9400550004847/sour-patch-kids-pascall | "Sour Patch Kids" | "1440" |
| http://world-en.openfoodfacts.org/product/9400550602487/brunch-mixed-berry-bar-cadbury | "Brunch Mixed Berry Bar" | "1810" |
| http://world-en.openfoodfacts.org/product/9400550646276/pascall-family-pack-sweets-fruit-bursts | "Pascall Family Pack Sweets Fruit Bursts" | "1427" |
| http://world-en.openfoodfacts.org/product/9400553011477/choc-thins-griffin-s | "Choc Thins" | "2010" |
| http://world-en.openfoodfacts.org/product/9400553438786/gingernuts-griffin-s | "Gingernuts" | "1810" |
| http://world-en.openfoodfacts.org/product/9400563448614/nice-natural-rosted-nut-bar-chocolate | "Nice & Natural Rosted Nut Bar - Chocolate" | "2060" |
| http://world-en.openfoodfacts.org/product/9400563740589/nut-bar-caramel-cashew-flavour-nice-natural | "Nut Bar - Caramel Cashew Flavour" | "1960" |
| http://world-en.openfoodfacts.org/product/9400563741784/superfruits-cranberry-blueberry-nice-natural | "Superfruits - Cranberry & Blueberry" | "1520" |
+------------------------------------------------------------------------------------------------------+---------------------------------------------+--------+

Following namespaces in SPARQL query

Given this data structure
#prefix core <http://www.w3.org/2004/02/skos/core#>
<http://localhost/myvocab/1> core#notation 1 .
<http://localhost/myvocab/1> <http://www.w3.org/2006/time#inDateTime> <http://localhost/myvocab/item1#DateDescription> .
<http://localhost/myvocab/item1#DateDescription> <http://www.w3.org/2006/time#year> 2016 ;
<http://www.w3.org/2006/time#month> "June"
If I run
select * where {?s ?p ?o .
<http://www.w3.org/2004/02/skos/core#notation> 1 . }
then only the first 2 triples (:hasID and :hasTime) are returned. Is there a sparql query (preferably not using a regex filter for matching the id) to return all triples from the child namespaces too?
I'm hoping I can achieve a result something along the lines of
-------------------------------------------------------------------------------------------------------------------------------------------------------
| s | p | o |
=======================================================================================================================================================
| <http://localhost/myvocab/item1> | <http://www.w3.org/2006/time#inDateTime> | <http://localhost/myvocab/item1#DateDescription |
| <http://localhost/myvocab/item1> | <http://www.w3.org/2004/02/skos/core#notation> | 1 |
| <http://localhost/myvocab/item1#DateDescription> | <http://www.w3.org/2006/time#month> | "June" |
| <http://localhost/myvocab/item1#DateDescription> | <http://www.w3.org/2006/time#year> | 2016 |
-------------------------------------------------------------------------------------------------------------------------------------------------------
It always helps if you provide data that we can actually load and property formed queries that you've tried. The data that you've shown isn't actually legal, nor is the query that you provided. Here's some sample data that's actually loadable:
#prefix core: <http://www.w3.org/2004/02/skos/core#>
<http://localhost/myvocab/1> core:notation 1 ;
<http://www.w3.org/2006/time#inDateTime> <http://localhost/myvocab/item1#DateDescription> .
<http://localhost/myvocab/item1#DateDescription> <http://www.w3.org/2006/time#year> 2016 ;
<http://www.w3.org/2006/time#month> "June"
If I understand you, you want to follow the :item1_DateTime object's properties too. You can do that with a property path that follows :item1's properties and value, and so on. In this query, I use (:|!:) as a wildcard, since every property is either : or it isn't. The * at the end means to follow paths of arbitrary length.
prefix core: <http://www.w3.org/2004/02/skos/core#>
select ?s ?p ?o where {
?s_ core:notation 1 ;
(<>|!<>)* ?s .
?s ?p ?o .
}
--------------------------------------------------------------------------------------------------------------------------------------------------
| s | p | o |
==================================================================================================================================================
| <http://localhost/myvocab/1> | <http://www.w3.org/2006/time#inDateTime> | <http://localhost/myvocab/item1#DateDescription> |
| <http://localhost/myvocab/1> | core:notation | 1 |
| <http://localhost/myvocab/item1#DateDescription> | <http://www.w3.org/2006/time#month> | "June" |
| <http://localhost/myvocab/item1#DateDescription> | <http://www.w3.org/2006/time#year> | 2016 |
--------------------------------------------------------------------------------------------------------------------------------------------------