thank you for reply, i have found the query from the internet as i had asked a question in other forums too, but i am not able to get any result and i am not sure why? because it looks alright logically, please have a look.
"prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"+ "prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"+ "prefix crm: <urn:x-stackoverflow:example#>\n"+ "\n"+ "SELECT * WHERE{\n"+ " [ crm:E21_Person [rdfs:label ?creator]\n"+ " ; crm:P108i_was_produced_by [ crm:P126_employed [ rdfs:label ?material ]\n"+ " ; crm:P4_has_time-span [ crm:P82_at_some_time_within ?timespan ]\n"+ " ]\n"+ " ; crm:P3_has_note [ a crm:P102_has_title\n"+ " ; rdfs:label ?title\n"+ " ]\n"+ " ]\n"+ " FILTER( ?creator = \"Brett WHITELEY\" ).\n"+ "}"; On Tue, Aug 26, 2014 at 9:13 PM, Andy Seaborne <[email protected]> wrote: > > Similarly in mysql it would be like > > > > select * from tablename where actor="Brett WHITELEY" > > Not really - the first step is to understand the triple structure of your > data. Printing in Turtle format makes that clearer: you cxna see it's > structured and not as a simple rcord as would be found in a single SQL > table. > > > @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . > @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . > @prefix crm: <http://www.cidoc-crm.org/cidoc-crm/> . > > <http://phdprototype.tk/collectionimage /4D0BFF17-5810-4644-A550- > D35EE090D4A8.png> > a "Painting" ; > rdfs:label "Brett WHITELEY" ; > crm:E21_Person [ a crm:E39_Actor ; > rdfs:label "Brett WHITELEY" > ] ; > crm:E62_String "Painting" ; > crm:P108i_was_produced_by > [ a crm:E12_Production ; > crm:P126_employed > [ a crm:E57_Material ; rdfs:label "Oil" ] ; > crm:P4_has_time-span > [ a crm:E52_Time-Span ; > crm:P82_at_some_time_within "\n 1976\n " > ] > ] ; > crm:P3_has_note > [ a crm:P102_has_title ; > > rdfs:label "Interior with Time Past" > ] ; > crm:P7_took_place_at > [ a crm:E53_Place ; > crm:E44_Place_Appellation "\n 5D\n " > ] ; > crm:P91_has_unit > [ a crm:E58_Measurement_Unit ; > > rdfs:label "182.0 h * 200.0 w cm" > ] . > > > SELECT * { ?x rdfs:label "Brett WHITELEY" } picks out 2 nodes because the > string occurs twice in two places. > > A SPARQl query is a graph templat - like Turtle with > > SELECT ?x ?titleString { > ?x rdfs:label "Brett WHITELEY" . > ?x crm:P3_has_note ?T . > ?T rdfs:label ?titleString . > } > > or (it's the much the same thing): > > SELECT ?x ?titleString { > ?x rdfs:label "Brett WHITELEY" . > ?x crm:P3_has_note [ rdfs:label ?titleString ] . > } > > picks out ?x, where ?x has a crm:P3_has_note and gets the rdfs:label. > > You'll need to add the prefixes. > > Andy > > > On 26/08/14 06:15, Ravi Vyas wrote: > >> Hi Andy, >> >> Thank you for the reply, well let me clear it in other way, i have created >> a rdf file using cidoc crm ontology, here is an example of that file. >> >> <rdf:Description rdf:about="http://phdprototype.tk/collectionimage >> /4D0BFF17-5810-4644-A550-D35EE090D4A8.png"> ` >> <rdfs:label>Brett WHITELEY</rdfs:label> >> <rdf:type>Painting</rdf:type> >> <crm:P3_has_note> >> <crm:P102_has_title> >> <rdfs:label>Interior with Time Past</rdfs:label> >> </crm:P102_has_title> >> </crm:P3_has_note> >> <crm:P91_has_unit> >> >> >> >> <crm:E58_Measurement_Unit> >> <rdfs:label>182.0 h * 200.0 w cm</rdfs:label> >> </crm:E58_Measurement_Unit> >> </crm:P91_has_unit> >> <crm:P7_took_place_at> >> <crm:E53_Place> >> <crm:E44_Place_Appellation> >> 5D >> </crm:E44_Place_Appellation> >> </crm:E53_Place> >> </crm:P7_took_place_at> >> <crm:P108i_was_produced_by> >> <crm:E12_Production> >> <crm:P126_employed> >> <crm:E57_Material> >> <rdfs:label>Oil</rdfs:label> >> </crm:E57_Material> >> </crm:P126_employed> >> <crm:P4_has_time-span> >> <crm:E52_Time-Span> >> <crm:P82_at_some_time_within> >> 1976 >> </crm:P82_at_some_time_within> >> </crm:E52_Time-Span> >> </crm:P4_has_time-span> >> </crm:E12_Production> >> </crm:P108i_was_produced_by> >> <crm:E62_String>Painting</crm:E62_String><crm:E21_Person>< >> E39_Actor><rdfs:label>Brett >> WHITELEY</rdfs:label></E39_Actor></crm:E21_Person> >> </rdf:Description> >> >> >> Now, if i pass a Brett WHITELEY as a parameter then it should return the >> title, time-span, material. But unfortunately i dont know how to get it >> from a rdf file using sparql. Similarly in mysql it would be like >> >> select * from tablename where actor="Brett WHITELEY" >> >> I hope this example will help you to understand the problem. Thanks >> for your time. >> >> Kind Regards, >> Ravi >> >> >> >> >> On Fri, Aug 22, 2014 at 9:53 PM, Andy Seaborne <[email protected]> wrote: >> >> Hi Ravi, >>> >>> I'm afraid I don't understand what your question is. >>> >>> What information is available to make the suggestion? A SPARQl query can >>> only rturn information that's available in the data being queried. If the >>> suggestion can only come from the information in the description of the >>> painting, then what suggestions might be possible? >>> >>> Andy >>> >>> >>> On 21/08/14 07:31, Ravi Vyas wrote: >>> >>> Hello, >>>> >>>> I my self Ravi Vyas, I am developing an IOS Application which is meant >>>> to >>>> enhanced the user experience in the museum. I have created a RDF file >>>> using >>>> CIDOC -CRM ontology which includes all the information of a museum such >>>> as >>>> painter name , year of painting, material which was used etc. >>>> >>>> I am new to Semantic web, after doing bit R.&D., i found that i will >>>> have >>>> to use an eclipse software which should include Apache jena files. Now >>>> the >>>> main of to develop a RDF file is to find a similar record or to give a >>>> suggestion to users when they would read about a painter's information. >>>> Here is a scenario, Alex is at level 2 of museum and he is reading about >>>> the Brett whitley who is a painter now when alex would click on a more >>>> information button, he should get a suggestion to go somewhere else and >>>> read about other painter's information. I believe that , it could be >>>> done >>>> using SPARQL. here is a SPARQL query which return an ID >>>> >>>> SELECT * WHERE { ?o rdfs:label ?'Brett WHITELEY' } LIMIT 10 >>>> >>>> >>>> Here is a record from my rdf file. >>>> >>>> <rdf:Description rdf:about=" >>>> >>>> http://phdprototype.tk/collectionimage/4D0BFF17-5810- >>>> 4644-A550-D35EE090D4A8.png >>>> "> >>>> <rdfs:label>Brett WHITELEY</rdfs:label> >>>> >>>> <crm:P3_has_note> >>>> <crm:P102_has_title> >>>> <rdfs:label>Interior with Time Past</rdfs:label> >>>> </crm:P102_has_title> >>>> </crm:P3_has_note> >>>> >>>> <crm:P91_has_unit> >>>> <crm:E58_Measurement_Unit> >>>> <rdf:value>182.0 h * 200.0 w cm</rdf:value> >>>> </crm:E58_Measurement_Unit> >>>> </crm:P91_has_unit> >>>> >>>> >>>> <crm:P7_took_place_at> >>>> <crm:E53_Place> >>>> <crm:E44_Place_Appellation> >>>> 5D >>>> </crm:E44_Place_Appellation> >>>> </crm:E53_Place> >>>> </crm:P7_took_place_at> >>>> >>>> <crm:P108i_was_produced_by> >>>> <crm:E12_Production> >>>> <rdfs:label>$EVENT_LABEL</rdfs:label> >>>> <crm:P126_employed> >>>> <crm:E57_Material> >>>> <rdfs:label>Oil</rdfs:label> >>>> <rdfs:label>Canvas</rdfs:label> >>>> </crm:E57_Material> >>>> </crm:P126_employed> >>>> >>>> <crm:P4_has_time-span> >>>> <crm:E52_Time-Span> >>>> <crm:P82_at_some_time_within> >>>> 1976 >>>> </crm:P82_at_some_time_within> >>>> </crm:E52_Time-Span> >>>> </crm:P4_has_time-span> >>>> </crm:E12_Production> >>>> </crm:P108i_was_produced_by> >>>> >>>> <crm:E62_String>Painting >>>> </crm:E62_String> >>>> <crm:E21_Person> >>>> <E39_Actor> >>>> <rdfs:label>Brett WHITELEY</rdfs:label> >>>> </E39_Actor> >>>> </crm:E21_Person> >>>> </rdf:Description> >>>> >>>> >>>> Kind Regards, >>>> Ravi >>>> >>>> >>>> >>> >> >
