VCityTeam / UD-Graph

Repository on graph models for Urban Data
Other
9 stars 1 forks source link

Parser error #41

Closed ZiyaUsta closed 2 weeks ago

ZiyaUsta commented 1 year ago

Can not parse CityGML file for transforming it to rdf. I receive this error:

Traceback (most recent call last): File "./XML2RDF.py", line 899, in main() File "./XML2RDF.py", line 28, in main transformer = XML2RdfTransformer(args) File "./XML2RDF.py", line 74, in init self.ontology.parse(path, format='xml') File "/opt/anaconda3/lib/python3.8/site-packages/rdflib/graph.py", line 1494, in parse parser.parse(source, self, **args) File "/opt/anaconda3/lib/python3.8/site-packages/rdflib/plugins/parsers/rdfxml.py", line 647, in parse self._parser.parse(source) File "/opt/anaconda3/lib/python3.8/xml/sax/expatreader.py", line 111, in parse xmlreader.IncrementalParser.parse(self, source) File "/opt/anaconda3/lib/python3.8/xml/sax/xmlreader.py", line 125, in parse self.feed(buffer) File "/opt/anaconda3/lib/python3.8/xml/sax/expatreader.py", line 221, in feed self._err_handler.fatalError(exc) File "/opt/anaconda3/lib/python3.8/xml/sax/handler.py", line 38, in fatalError raise exception xml.sax._exceptions.SAXParseException: https://dataset-dl.liris.cnrs.fr/rdf-owl-urban-data-ontologies/Ontologies/CityGML/2.0/:1:54: syntax error

So I suspect parser can not parse sample CityGML file correctly

DiegoVinasco commented 1 year ago

I think I see the problem.

Currently, the XML2RDF transformer can parse either:

But the link https://dataset-dl.liris.cnrs.fr/rdf-owl-urban-data-ontologies/Ontologies/CityGML/2.0/ resolves to a directory on an online file server (which the file parser, RDFlib, can't parse).

What happens if you try pointing to a file on the online file server like https://dataset-dl.liris.cnrs.fr/rdf-owl-urban-data-ontologies/Ontologies/CityGML/2.0/core.ttl

or ...

After cloning this repository try pointing to a directory containing local ontologies like [path to repository]/UD-Graph/Ontologies/CityGML/2.0

Also, could you provide the arguments you're passing to the XML2RDF transformer?

DiegoVinasco commented 1 year ago

The latest PR included some updates to how the XML2RDF transformer parses input files. This may have fixed this bug if it isn't related to my previous comment.