Thanks for your answer! Dmitri Pisarenko
08.02.2017, 11:02, "Lorenz B." <[email protected]>: > This heavily depends on what you want. SPARQL resultset is basically a > set of rows similar to SQL resultset. > > If you want to have the FirstContactTime of whatever is bound to ?x as > well, you have to append another triple pattern > > ?x <URI_OF_FirstContactTime_PROPERTY> ?val . > > And then each item (aka row) in the returned resultset contains the > value of ?x and the value of ?val - if exist in the knowledge base. > Note, that if there are multiple values for FirstContactTime, you'll get > multiple rows with the same value for ?x but different ones for each > value of > >>> The result of a SPARQL query contains only what you selected in the >>> SPARQL query. Nothing more, nothing less. >> So how should I change the query to get a property value? >> >> Thanks >> >> Dmitri Pisarenko >> >> 08.02.2017, 10:21, "Lorenz B." <[email protected]>: >>> The result of a SPARQL query contains only what you selected in the >>> SPARQL query. Nothing more, nothing less. And you select only "things >>> that have an email address". >>> >>>> Hello! >>>> >>>> I have the following code, in which I find a resource by its e-mail. >>>> >>>> val varn = "x" >>>> val query = createQuery("""SELECT ?${varn} >>>> WHERE { ?x >>>> <http://www.w3.org/2001/vcard-rdf/3.0#EMAIL> "${email}" }""") >>>> val qexec = createQueryExecution(ds, query) >>>> val rs = qexec.execSelect() >>>> if (rs.hasNext()) { >>>> val solution = rs.nextSolution() >>>> val rec = solution[varn] >>>> // Here I need to find the value of the property >>>> FirstContactTime >>>> } >>>> >>>> Now I want to find out whether `rec` has a property `FirstContactTime` >>>> and if yes, its value. >>>> >>>> I tried >>>> `rec.model.listObjectsOfProperty(ds.defaultModel.createProperty(FirstContactTime))` >>>> but it doesn't return anything. The debugger says `rec` does have a >>>> property `FirstContactTime`. >>>> >>>> How can I get the value of `FirstContactTime` (`2017-03-03T10:35:00Z`) >>>> in my code? >>>> >>>> Thanks in advance >>>> >>>> Dmitri Pisarenko >>> -- >>> Lorenz Bühmann >>> AKSW group, University of Leipzig >>> Group: http://aksw.org - semantic web research center > > -- > Lorenz Bühmann > AKSW group, University of Leipzig > Group: http://aksw.org - semantic web research center
