I'm having the following problem when using rdflib serialize() method to print the graph. The layout changes from the original file used to create the graph.
The code is as follows
from rdflib import Graph
mapping_graph = Graph().parse("valid_mapping.ttl", format="ttl")
print(mapping_graph.serialize(format="ttl").decode("utf-8"))
Which outputs
<file:///home/alex/Desktop/Mapping-Quality-Framework/Mapping-Quality-Model/valid_mapping.ttl#TripleMap1> rr:logicalTable [ rr:tableName "people" ] ;
rr:predicateObjectMap [ rr:objectMap [ rr:column "publications" ;
rr:language "en-GB" ] ;
rr:predicate foaf:publications ;
rr:termType rr:Literal ],
[ rr:objectMap [ rr:column "age" ;
rr:datatype xsd:second ] ;
rr:predicate foaf:age ],
[ rr:objectMap [ rr:column "age" ;
rr:datatype xsd:third ;
rr:language "dhhdhd" ] ;
rr:predicate dbo:equipment ] ;
rr:subjectMap [ rr:class foaf:ggg ] .
While the input file is
<#TripleMap1>
rr:logicalTable [ rr:tableName "people" ] ;
rr:subjectMap [ rr:class foaf:ggg ];
rr:predicateObjectMap [ rr:predicate foaf:publications ;
rr:termType rr:Literal;
rr:objectMap [ rr:column "publications" ;
rr:language "en-GB" ] ;
];
rr:predicateObjectMap
[ rr:predicate foaf:age;
rr:objectMap [ rr:column "age" ;
rr:datatype xsd:second ] ;
];
rr:predicateObjectMap
[ rr:predicate dbo:equipment;
rr:objectMap [ rr:column "age" ;
rr:datatype xsd:third;
rr:language "dhhdhd"] ; ] ;
.
The layout of the graph is changed by the serialize() method.
Any help would be gratefully appreciated.