jena-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Campbell <rrc...@gmail.com>
Subject Re: Missing elements in the model
Date Thu, 16 Dec 2010 16:34:50 GMT
Here is the correct query:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       PREFIX c:   <http://s.opencalais.com/1/pred/>
       SELECT ?company ?name ?ticker ?symbol WHERE {
         ?company  rdf:type  <http://s.opencalais.com/1/type/er/Company> .
         ?company  c:name    ?name    .
         ?company  c:ticker  ?ticker  .
         ?company  c:symbol  ?symbol
       }


On Thu, Dec 16, 2010 at 5:16 PM, Robert Campbell <rrc7cz@gmail.com> wrote:
> I was too excited and that SPARQL I posted doesn't work correctly. It
> returns what appears to be a join, which is not what I want (I'm new
> to all of this):
>
> (http://d.opencalais.com/er/company/ralg-tr1r/4ee13d20-b44f-3bce-98bc-49a303e72db5,Microsoft
> Corporation,MSFT,MSFT.OQ),
> (http://d.opencalais.com/er/company/ralg-tr1r/4ee13d20-b44f-3bce-98bc-49a303e72db5,Dell
> Inc.,DELL,DELL.OQ),
> (http://d.opencalais.com/er/company/ralg-tr1r/a9739942-cae7-38d0-940e-6d84aed47ae6,Microsoft
> Corporation,MSFT,MSFT.OQ),
> (http://d.opencalais.com/er/company/ralg-tr1r/a9739942-cae7-38d0-940e-6d84aed47ae6,Dell
> Inc.,DELL,DELL.OQ),
> (http://d.opencalais.com/er/company/ralg-tr1r/17de1dc9-0806-32e0-ba05-fbf5996c3ec0,Microsoft
> Corporation,MSFT,MSFT.OQ),
> (http://d.opencalais.com/er/company/ralg-tr1r/17de1dc9-0806-32e0-ba05-fbf5996c3ec0,Dell
> Inc.,DELL,DELL.OQ))
>
> Anyway, once I get it working I'll repost it to this thread for posterity.
>
>
>
> On Thu, Dec 16, 2010 at 5:13 PM, Robert Campbell <rrc7cz@gmail.com> wrote:
>> Hi Chris,
>>
>> That makes perfect sense and I really appreciate the detailed
>> response. I was able to change my SPARQL so that it successfully pulls
>> this rdf:about (subject) from the model, for example querying for
>> companies:
>>
>>       PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
>>       PREFIX c:   <http://s.opencalais.com/1/pred/>
>>       SELECT ?about ?name ?ticker ?symbol WHERE {
>>         ?about rdf:type <http://s.opencalais.com/1/type/er/Company> .
>>         ?company c:name    ?name   .
>>         ?company c:ticker  ?ticker .
>>         ?company c:symbol  ?symbol
>>       }
>>
>> Rob
>>
>>
>> On Thu, Dec 16, 2010 at 4:59 PM, Chris Dollin
>> <chris.dollin@epimorphics.com> wrote:
>>> On Thursday, December 16, 2010 02:37:48 pm Robert Campbell wrote:
>>>> I'm parsing an XML/RDF model from OpenCalais which looks like this:
>>>>
>>>> ...
>>>>       <rdf:Description c:contentType="text/raw" c:emVer="7.1.1103.5"
>>>> c:langIdVer="DefaultLangId" c:language="English"
>>>> c:processingVer="CalaisJob01" c:submissionDate="2009-12-10
>>>> 06:34:26.635" rdf:about="http://d.opencalais.com/dochash-1/dd3d9746-bbd3-3bd8-abdd-ee102300c824/meta">
>>>>               <rdf:type rdf:resource="http://s.opencalais.com/1/type/sys/DocInfoMeta"/>
>>>>               <c:docId rdf:resource="http://d.opencalais.com/dochash-1/dd3d9746-bbd3-3bd8-abdd-ee102300c824"/>
>>>>               <c:submitterCode>c8b1bf20-11b5-9426-afb8-1af10ced91a7</c:submitterCode>
>>>>               <c:signature>digestalg-1|BA85RL4uWFjMjCfSa0k6iHqawts=|TTosv0VIPySK4HwUpxl76Yvh/ZwIjjCGwCRBAqjB+tDkZNcQUHmLUQ==</c:signature>
>>>>       </rdf:Description>
>>>> ...
>>>>
>>>> and the Jena model looks like this:
>>>>
>>>> ...
>>>> http://d.opencalais.com/dochash-1/c2156224-66ed-3538-89f2-7c4b4b197809/meta
>>>> @c:submissionDate "2010-12-16 05:24:30.722";
>>>> http://d.opencalais.com/dochash-1/c2156224-66ed-3538-89f2-7c4b4b197809/meta
>>>> @c:docId http://d.opencalais.com/dochash-1/c2156224-66ed-3538-89f2-7c4b4b197809;
>>>> http://d.opencalais.com/dochash-1/c2156224-66ed-3538-89f2-7c4b4b197809/meta
>>>> @rdf:type http://s.opencalais.com/1/type/sys/DocInfoMeta;
>>>> http://d.opencalais.com/dochash-1/c2156224-66ed-3538-89f2-7c4b4b197809/meta
>>>> @c:language "English";
>>>> http://d.opencalais.com/dochash-1/c2156224-66ed-3538-89f2-7c4b4b197809/meta
>>>> @c:processingVer "CalaisJob01";
>>>> http://d.opencalais.com/dochash-1/c2156224-66ed-3538-89f2-7c4b4b197809/meta
>>>> @c:emVer "7.1.1103.5";
>>>> http://d.opencalais.com/dochash-1/c2156224-66ed-3538-89f2-7c4b4b197809/meta
>>>> @c:submitterCode "c8b1bf20-11b5-9426-afb8-1af10ced91a7";
>>>> http://d.opencalais.com/dochash-1/c2156224-66ed-3538-89f2-7c4b4b197809/meta
>>>> @c:contentType "TEXT/RAW";
>>>> http://d.opencalais.com/dochash-1/c2156224-66ed-3538-89f2-7c4b4b197809/meta
>>>> @c:langIdVer "DefaultLangId";
>>>> http://d.opencalais.com/dochash-1/c2156224-66ed-3538-89f2-7c4b4b197809/meta
>>>> @c:signature "digestalg-1|uUMwnVwAYwcoIRl2ozky6uBts7Y=|f6zt1E2yFp3X0TQ8KAJi1TjwAhRMGK0WjmJXDhRTw1rUs6oLbBwP3w==";
>>>> ...
>>>>
>>>> but what's missing is the "rdf:about" attribute in the rdf:Description
>>>> node. I need to be able to query this model to get the rdf:about value
>>>> along with many others, but it doesn't seem to be in the model at all.
>>>> What am I missing?
>>>
>>> rdf:about is just RDF/XML syntax; it doesn't exist in the RDF triple model.
>>> It says what the subject of the implied triples is. For example, in your
>>> RDF/XML we see:
>>>
>>>  rdf:about="http://d.opencalais.com/dochash-1/dd3d9746-bbd3-3bd8-abdd-ee102300c824/meta"
>>>
>>> with
>>>
>>>  <rdf:type rdf:resource="http://s.opencalais.com/1/type/sys/DocInfoMeta"/>
>>>
>>> And in the model (which is being written out using the informal toString()
>>> notation, subject @predicate object) we see things like:
>>>
>>>  http://d.opencalais.com/dochash-1/c2156224-66ed-3538-89f2-7c4b4b197809/meta
>>>  @rdf:type http://s.opencalais.com/1/type/sys/DocInfoMeta
>>>
>>> (looks much better with model.write(System.out, "TTL") for Turtle notation).
>>> (Yes, different URL because incomplete data in post)
>>>
>>> The nested <rdf:type ...> has turned into a predicate, and the rdf:about
has
>>> made http://lotsofstuff/meta the subject in the statement with that predicate.
>>>
>>> The XML structure of RDF/XML is pretty much irrelevant once it has
>>> been read into a model.
>>>
>>> Chris
>>>
>>> --
>>> "He remembered -- not one thing, not another thing, nor a logical /Whose Body?/
>>>  succession of things, but everything -- the whole thing, perfect,
>>>  complete in all its dimensions as it were and instantaneously; as if he
>>>  stood outside the world and saw it suspended in infinitely-dimensional space."
>>>
>>> Epimorphics Ltd, http://www.epimorphics.com
>>> Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20 6PT
>>> Epimorphics Ltd. is a limited company registered in England (number 7016688)
>>>
>>
>

Mime
View raw message