rdf:type abbreviation "a"

733 views
Skip to first unread message

Leigh Klotz

unread,
Apr 16, 2013, 2:01:12 PM4/16/13
to rdfli...@googlegroups.com
Forgive me if this is covered, but it's really hard to search for.  I

'd like to output the "a" abbreviation for rdf:type in as a predicate in Turtle serialization in rdflib.

I couldn't find anything obvious to do it and would up doing this:

class Abbreviation(URIRef):
    def n3(self):
        return str(self)

A = Abbreviation('a')

Is there something obvious I'm overlooking?

Leigh.


Gunnar Aastrand Grimnes

unread,
Apr 20, 2013, 7:48:02 AM4/20/13
to rdfli...@googlegroups.com
Hi Leigh,

Sorry for the late reply.

Actually - the Turtle and N3 Serializers produce "a" for rdf:type out
of the box - you do not need to do anything.

In [1]: import rdflib

In [2]: g=rdflib.Graph()

In [3]: g.add((rdflib.RDF.type, rdflib.RDF.type, rdflib.RDF.Property))

In [4]: g.serialize(format='turtle')
Out[4]: '@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
.\n\nrdf:type a rdf:Property .\n\n'


Can you give us an example where it doesn't work?

- Gunnar
> --
> http://github.com/RDFLib
> ---
> You received this message because you are subscribed to the Google Groups
> "rdflib-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rdflib-dev+...@googlegroups.com.
> To post to this group, send email to rdfli...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rdflib-dev/-/J6dN_DSe_aAJ.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
http://gromgull.net
Reply all
Reply to author
Forward
0 new messages