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

Stuart A. Yeates syeates at gmail.com
Sat Apr 25 11:31:29 CEST 2009


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
>


More information about the doap-interest mailing list