By the way I have some requirement that makes that the language used for ontology representation or for the content language could be anything. Hence, i can not impose Jena formalism throughout the all system. I need to have some abstract intermediary representation.





On Aug 22, 2011, at 12:02 PM, Dave Reynolds wrote:

On 21/08/2011 19:19, Maatary Daniel OKOUYA wrote:

And Here is an example of an actual RDF file representing a message
based on the application independent and specific ontology mentioned
above. It represent a promise content message send from an Agent to
another.


<!DOCTYPErdf:RDF[<!ENTITYxsd"http://www.w3.org/2001/XMLSchema#";>]>
<rdf:RDFxmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
xmlns:ocean="http://www.people.lu.unisi.ch/fornaran/schemas/ocean-rdf0# "
xmlns:app="http://www.people.lu.unisi.ch/fornaran/schemas/app-rdf0#";
xml:base="http://www.people.lu.unisi.ch/fornaran/example/promise";>

<app:Payrdf:ID="JohnAction1">
<ocean:hasActor>John</ocean:hasActor>
<ocean:hasDuration>2</ocean:hasDuration>
<app:hasRecipient>Mary</app:hasRecipient>
<app:hasAmount>5</app:hasAmount>
</app:Pay>


<app:Deliverrdf:ID="MaryAction1">
<ocean:hasActor>Mary</ocean:hasActor>
<app:hasRecipient>John</app:hasRecipient>
<app:hasObject>book1</app:hasObject>
</app:Deliver>
</rdf:RDF>

[Snip]

I need to parse this late file, distinduishingm what is an action, a
predicate and a concept/object (which can not be a content on its won as
explain above). The main issue here comes between differentiating
between action and concept.

Don't know what you mean by concept here but, for example, to find all Actions then create a model which contains you base data and your ontology and query it for patterns of the form:

  ?a rdf:type [ rdfs:subClassOf  eg:Action]

Then for each Action resource you find you can list its properties using Resource.listProperties.

Basically i have my ontology programatically available while parsing
that file. So base on the name of the tag or the type if the
RDFdescription for is used, i can find out if its correspond to an
action or a know concept. But the thing is, it could be malformed.
I need to check that if i have 2 outmost node then they both are action. if i have a an action and an object/concept, then this object/ concept is
the definition of the object specify in the property of the resource.

Don't think in terms of the RDF/XML syntax, do think about tags and XML tree structure. There are so many ways that the same RDF model can be serialized in XML that anything like that will be fragile. The point of Jena is that it allows you to parse the file into a Model and work on that data using the Model API and/or SPARQL queries - the XML syntax is not relevant.

Dave

Reply via email to