[doap-interest] advice on how to change code parsing doap files

James Howison james at howison.name
Sat Apr 25 21:01:06 CEST 2009


Validating RDF is a tricky concept because of open-world reasoning.  
i.e. in RDF/RDFS/OWL reasoning, at least, one can't assume that one  
has 'gathered' all the statements about a particular Resource, so one  
can only reason with what is known to be true, and absence doesn't  
count as negation. So while I'm not saying one wouldn't want to do it,  
things basically work very differently from XLST logic.

As you guys are doing one can use a SPARQL query to procedurally check  
that you have the statements you expect.

There is work afoot to introduce declarative "validation" to RDF/OWL  
via the Pellet reasoner, better called "integrity constraints",  
definitely worth reading:

http://clarkparsia.com/weblog/category/semweb/owl/pellet/integrity-constraints/

--J

On 25 Apr 2009, at 5:31 AM, Stuart A. Yeates wrote:

> If I understand the problem correctly the following code should work:
>
>
> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
> PREFIX dc: <http://purl.org/dc/elements/1.1/>
> PREFIX doap: <http://usefulinc.com/ns/doap#>
> PREFIX foaf: <http://xmlns.com/foaf/0.1/>
> SELECT ?projectId, ?name, ?branch, ?revision, ?created, ?description
> WHERE {
>     ?project rdf:type doap:Project .
>     ?project doap:shortname ?projectId .
>     ?project doap:release ?release .
>     ?release doap:name ?name .
>     ?release doap:branch ?branch .
>     ?release doap:revision ?revision .
>     ?release doap:created ?created
>     ?release doap:version ?ignore
>     OPTIONAL { ?release dc:description ?description }
> }
> ORDER BY DESC(?created)
>
> Basically requiring a doap:version triple there, but ignoring the  
> value.
>
> I don't have immediate access to a sparql endpoint with the data in to
> test this though.
>
> I don't believe that "validating" RDF files makes much sense. I prefer
> to think of "how much data do I need to do this operation?" and
> working from there.
>
> cheers
> stuart
>
> On Sat, Apr 25, 2009 at 9:08 PM, Thomas Vander Stichele
> <thomas at apestaart.org> wrote:
>> Hi,
>>
>> in my code (MOAP) I parse a .doap file and create the various objects
>> from the .doap file.
>>
>> Someone said he preferred my code to error out if a <Version> section
>> was missing required information, and I agree with him.  Right now it
>> just silently skips it.
>>
>> It does so because I have this SPARQL query in my code:
>>
>> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
>> PREFIX dc: <http://purl.org/dc/elements/1.1/>
>> PREFIX doap: <http://usefulinc.com/ns/doap#>
>> PREFIX foaf: <http://xmlns.com/foaf/0.1/>
>> SELECT ?projectId, ?name, ?branch, ?revision, ?created, ?description
>> WHERE {
>>      ?project rdf:type doap:Project .
>>      ?project doap:shortname ?projectId .
>>      ?project doap:release ?release .
>>      ?release doap:name ?name .
>>      ?release doap:branch ?branch .
>>      ?release doap:revision ?revision .
>>      ?release doap:created ?created
>>      OPTIONAL { ?release dc:description ?description }
>> }
>> ORDER BY DESC(?created)
>>
>>
>> My first instinct was to move all of the release-related WHERE  
>> sections
>> into an OPTIONAL, but then I stopped and thought:
>>
>> "shouldn't the point of describing the syntax of doap allow me to
>> validate any .doap file in the first place" ?
>>
>> So, since you're all much more expert than me, please tell me:
>> - what would be the right approach to validate any .doap file against
>> required arguments for all its sections
>> - how would I do this using redland (and its python bindings) ?
>> - how can it be avoided to do a web lookup every time for the syntax
>> files ?
>>
>> Thanks
>> Thomas
>>
>> --
>> Ik heb vannacht gedronken en gezien
>> Hoe jij van mij nooit krijgt wat je verdient
>> --
>> URGent, best radio on the net - 24/7 !
>> http://urgent.fm/
>>
>>
>> _______________________________________________
>> doap-interest mailing list
>> doap-interest at lists.usefulinc.com
>> http://lists.usefulinc.com/mailman/listinfo/doap-interest
>>
> _______________________________________________
> doap-interest mailing list
> doap-interest at lists.usefulinc.com
> http://lists.usefulinc.com/mailman/listinfo/doap-interest



More information about the doap-interest mailing list