Want to get predicates URIs

44 views
Skip to first unread message

mayank Agarwal

unread,
Feb 15, 2022, 8:49:18 AM2/15/22
to rdflib-dev
Hello,
I am able to generate my RDF triples in .ttl format. I would like to ask two things:

1. When I save my RDF triples in .ttl format. It is saved taking subject in alphabetical order (first number and then follow alphabetical order) Could you please check why it is so?

2. When I am trying to apply URIRef to handle rdf triples predicates(URIs) for which I am getting a warning message: 'Predicate' does not look like a valid URI, trying to serialize this will break.
What Should I change?

Attaching the screenshots and sample ttl file.


my code snippet:
def build_result_graph(triples):
    """ Builds a rdf graph with the result triples """
    g = Graph()
    for triple in triples:
        g.bind('ex',EX)
        g.bind('foaf', FOAF)
        g.bind('schema', SDO)
        g.bind('dcterms',DCTERMS)
        subj = triple[0]
        pred = triple[1]
        objct =triple[2]
        g.add((subj, OWL.Ontology, objct))
   g.serialize(destination='file' + str(counter) + ".ttl", format='ttl'
    return g
RDf_triples_predicates.png
RDF_triples_ttl.png
sample_rdftriples_ttl.txt

Nicholas Car

unread,
Mar 7, 2022, 5:10:19 AM3/7/22
to rdfli...@googlegroups.com
Sorry Mayank but this is the developers of RDFLib mailing list, not a users assistance list. For these kind of questions, please use StackOverflow and tag with [rdflib]. Thanks, Nick

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/rdflib-dev/f39b95f9-2078-42f1-b2a4-f5622caaf3c1n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages