[
https://issues.apache.org/jira/browse/JENA-594?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14259772#comment-14259772
]
Bruno P. Kinoshita commented on JENA-594:
-----------------------------------------
{{`jena.rdfcat`}} now will print the usage, since the user didn't provide any
input (I couldn't find the usage, but later noticed that I can trigger it by
using {{`jena.rdfcat usage`}}).
{{`jena.rdfcat -out N3 -x file:sample.rdf`}} works as expected.
> Using -, non RDF/XML content is silently ignored. Specifying -n gets it
> treated correctly.
{noformat}
$ echo '<s> <p> <o>' | rdfcat -
WARN [main] (ErrorHandlerFactory.java:77) - [line: 1, col: 4 ] {W104}
Unqualified typed nodes are not allowed. Type treated as a relative URI.
WARN [main] (ErrorHandlerFactory.java:77) - [line: 1, col: 4 ] {W136} Relative
URIs are not permitted in RDF: specifically <s>
WARN [main] (ErrorHandlerFactory.java:77) - [line: 1, col: 8 ] {W104}
Unqualified property elements are not allowed. Treated as a relative URI.
WARN [main] (ErrorHandlerFactory.java:77) - [line: 1, col: 8 ] {W136} Relative
URIs are not permitted in RDF: specifically <p>
WARN [main] (ErrorHandlerFactory.java:77) - [line: 1, col: 12] {W104}
Unqualified typed nodes are not allowed. Type treated as a relative URI.
WARN [main] (ErrorHandlerFactory.java:77) - [line: 1, col: 12] {W136} Relative
URIs are not permitted in RDF: specifically <o>
ERROR [main] (ErrorHandlerFactory.java:84) - [line: 2, col: 1 ] XML document
structures must start and end within the same entity.
Exception in thread "main" org.apache.jena.riot.RiotException: [line: 2, col: 1
] XML document structures must start and end within the same entity.
at
org.apache.jena.riot.system.ErrorHandlerFactory$ErrorHandlerStd.fatal(ErrorHandlerFactory.java:136)
at
org.apache.jena.riot.lang.LangRDFXML$ErrorHandlerBridge.fatalError(LangRDFXML.java:249)
at
com.hp.hpl.jena.rdfxml.xmlinput.impl.ARPSaxErrorHandler.fatalError(ARPSaxErrorHandler.java:48)
at
com.hp.hpl.jena.rdfxml.xmlinput.impl.XMLHandler.warning(XMLHandler.java:200)
at
com.hp.hpl.jena.rdfxml.xmlinput.impl.XMLHandler.fatalError(XMLHandler.java:230)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.endEntity(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown
Source)
at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
at org.apache.xerces.impl.XMLEntityScanner.scanContent(Unknown Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanContent(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at
com.hp.hpl.jena.rdfxml.xmlinput.impl.RDFXMLParser.parse(RDFXMLParser.java:151)
at com.hp.hpl.jena.rdfxml.xmlinput.ARP.load(ARP.java:119)
at org.apache.jena.riot.lang.LangRDFXML.parse(LangRDFXML.java:139)
at
org.apache.jena.riot.RDFParserRegistry$ReaderRIOTLang.read(RDFParserRegistry.java:185)
at org.apache.jena.riot.RDFDataMgr.process(RDFDataMgr.java:906)
at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:257)
at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:243)
at
org.apache.jena.riot.adapters.RDFReaderRIOT.read(RDFReaderRIOT.java:70)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.read(ModelCom.java:277)
at jena.rdfcat.readInput(rdfcat.java:374)
at jena.rdfcat$ReadAction.run(rdfcat.java:556)
at jena.rdfcat.go(rdfcat.java:282)
at jena.rdfcat.main(rdfcat.java:260)
$ echo '<s> <p> <o>' | rdfcat -n -
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:j.0="file:///opt/jena-fuseki-1.0.2/">
<rdf:Description rdf:about="file:///opt/jena-fuseki-1.0.2/s">
<j.0:p rdf:resource="file:///opt/jena-fuseki-1.0.2/o"/>
</rdf:Description>
</rdf:RDF>
{noformat}
> -n with /dev/stdin works, too. Using /dev/stdin with no format option blows
> up, though. (It's not silently ignored like - was)
{noformat}
$ echo '<s> <p> <o>' | rdfcat -n /dev/stdin
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:j.0="file:///dev/">
<rdf:Description rdf:about="file:///dev/s">
<j.0:p rdf:resource="file:///dev/o"/>
</rdf:Description>
</rdf:RDF>
$ echo '<s> <p> <o>' | rdfcat /dev/stdin
SNAPSHOT-server.jar jena.rdfcat /dev/stdin
WARN [main] (ErrorHandlerFactory.java:77) - [line: 1, col: 4 ] {W104}
Unqualified typed nodes are not allowed. Type treated as a relative URI.
WARN [main] (ErrorHandlerFactory.java:77) - [line: 1, col: 4 ] {W136} Relative
URIs are not permitted in RDF: specifically <s>
WARN [main] (ErrorHandlerFactory.java:77) - [line: 1, col: 8 ] {W104}
Unqualified property elements are not allowed. Treated as a relative URI.
WARN [main] (ErrorHandlerFactory.java:77) - [line: 1, col: 8 ] {W136} Relative
URIs are not permitted in RDF: specifically <p>
WARN [main] (ErrorHandlerFactory.java:77) - [line: 1, col: 12] {W104}
Unqualified typed nodes are not allowed. Type treated as a relative URI.
WARN [main] (ErrorHandlerFactory.java:77) - [line: 1, col: 12] {W136} Relative
URIs are not permitted in RDF: specifically <o>
ERROR [main] (ErrorHandlerFactory.java:84) - [line: 2, col: 1 ] XML document
structures must start and end within the same entity.
Exception in thread "main" org.apache.jena.riot.RiotException: [line: 2, col: 1
] XML document structures must start and end within the same entity.
at
org.apache.jena.riot.system.ErrorHandlerFactory$ErrorHandlerStd.fatal(ErrorHandlerFactory.java:136)
at
org.apache.jena.riot.lang.LangRDFXML$ErrorHandlerBridge.fatalError(LangRDFXML.java:249)
at
com.hp.hpl.jena.rdfxml.xmlinput.impl.ARPSaxErrorHandler.fatalError(ARPSaxErrorHandler.java:48)
at
com.hp.hpl.jena.rdfxml.xmlinput.impl.XMLHandler.warning(XMLHandler.java:200)
at
com.hp.hpl.jena.rdfxml.xmlinput.impl.XMLHandler.fatalError(XMLHandler.java:230)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.endEntity(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown
Source)
at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
at org.apache.xerces.impl.XMLEntityScanner.scanContent(Unknown Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanContent(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at
com.hp.hpl.jena.rdfxml.xmlinput.impl.RDFXMLParser.parse(RDFXMLParser.java:151)
at com.hp.hpl.jena.rdfxml.xmlinput.ARP.load(ARP.java:119)
at org.apache.jena.riot.lang.LangRDFXML.parse(LangRDFXML.java:139)
at
org.apache.jena.riot.RDFParserRegistry$ReaderRIOTLang.read(RDFParserRegistry.java:185)
at org.apache.jena.riot.RDFDataMgr.process(RDFDataMgr.java:906)
at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:687)
at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:210)
at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:143)
at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:132)
at
org.apache.jena.riot.adapters.AdapterFileManager.readModelWorker(AdapterFileManager.java:283)
at com.hp.hpl.jena.util.FileManager.readModel(FileManager.java:344)
at jena.rdfcat.readInput(rdfcat.java:379)
at jena.rdfcat$ReadAction.run(rdfcat.java:556)
at jena.rdfcat.go(rdfcat.java:282)
at jena.rdfcat.main(rdfcat.java:260)
{noformat}
The following also works as expected.
{noformat}
$ cat books.ttl | jena.rdfcat -n /dev/stdin
$ cat books.ttl | jena.rdfcat -n -
{noformat}
Both output
{noformat}
<rdf:RDF
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#"
xmlns="http://example.org/book/"
xmlns:ns="http://example.org/ns#">
<rdf:Description rdf:about="http://example.org/book/book7">
<dc:title>Harry Potter and the Deathly Hallows</dc:title>
<dc:creator>J.K. Rowling</dc:creator>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/book/book1">
<dc:title>Harry Potter and the Philosopher's Stone</dc:title>
<dc:creator>J.K. Rowling</dc:creator>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/book/book2">
<dc:title>Harry Potter and the Chamber of Secrets</dc:title>
<dc:creator>
<rdf:Description rdf:nodeID="A0">
<vcard:FN>J.K. Rowling</vcard:FN>
<vcard:N rdf:parseType="Resource">
<vcard:Family>Rowling</vcard:Family>
<vcard:Given>Joanna</vcard:Given>
</vcard:N>
</rdf:Description>
</dc:creator>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/book/book5">
<dc:title>Harry Potter and the Order of the Phoenix</dc:title>
<dc:creator>J.K. Rowling</dc:creator>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/book/book6">
<dc:title>Harry Potter and the Half-Blood Prince</dc:title>
<dc:creator>J.K. Rowling</dc:creator>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/book/book3">
<dc:title>Harry Potter and the Prisoner Of Azkaban</dc:title>
<dc:creator rdf:nodeID="A0"/>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/book/book4">
<dc:title>Harry Potter and the Goblet of Fire</dc:title>
</rdf:Description>
</rdf:RDF>
{noformat}
> rdfcat silently ignores - as stdin if input type isn't specified
> ----------------------------------------------------------------
>
> Key: JENA-594
> URL: https://issues.apache.org/jira/browse/JENA-594
> Project: Apache Jena
> Issue Type: Bug
> Components: Cmd line tools
> Affects Versions: Jena 2.11.0
> Reporter: Joshua Taylor
> Priority: Minor
> Labels: rdfcat, riot
>
> Treatment of content from standard in by - and /dev/stdin differs when format
> is not specified.
> Using -, non RDF/XML content is silently ignored. Specifying -n gets it
> treated correctly.
> {noformat}
> $ echo '<s> <p> <o>' | rdfcat -
> <rdf:RDF
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
> </rdf:RDF>
> $ echo '<s> <p> <o>' | rdfcat -n -
> <rdf:RDF
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
> xmlns:j.0="file:///home/taylorj/tmp/">
> <rdf:Description rdf:about="file:///home/taylorj/tmp/s">
> <j.0:p rdf:resource="file:///home/taylorj/tmp/o"/>
> </rdf:Description>
> </rdf:RDF>
> {noformat}
> -n with /dev/stdin works, too. Using /dev/stdin with no format option blows
> up, though. (It's not silently ignored like - was)
> {noformat}
> $ echo '<s> <p> <o>' | rdfcat -n /dev/stdin
> <rdf:RDF
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
> xmlns:j.0="file:///dev/">
> <rdf:Description rdf:about="file:///dev/s">
> <j.0:p rdf:resource="file:///dev/o"/>
> </rdf:Description>
> </rdf:RDF>
> $ echo '<s> <p> <o>' | rdfcat /dev/stdin
> 11:46:21 WARN riot :: {W104} Unqualified typed nodes are not
> allowed. Type treated as a relative URI.
> 11:46:21 WARN riot :: {W136} Relative URIs are not permitted
> in RDF: specifically <s>
> 11:46:21 WARN riot :: {W104} Unqualified property elements
> are not allowed. Treated as a relative URI.
> 11:46:21 WARN riot :: {W136} Relative URIs are not permitted
> in RDF: specifically <p>
> 11:46:21 WARN riot :: {W104} Unqualified typed nodes are not
> allowed. Type treated as a relative URI.
> 11:46:21 WARN riot :: {W136} Relative URIs are not permitted
> in RDF: specifically <o>
> 11:46:21 ERROR riot :: XML document structures must start and
> end within the same entity.
> Exception in thread "main" org.apache.jena.riot.RiotException: XML document
> structures must start and end within the same entity.
> at
> org.apache.jena.riot.system.ErrorHandlerFactory$ErrorHandlerStd.fatal(ErrorHandlerFactory.java:136)
> …
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)