Open amolik opened 4 years ago
Additional statement for type is getting returned by rdflib.parse In the code snippet below, there are two rdf:type, but rdflib.parse is returning three statements for type. 3 types are getting returned.
const rdflib = require('rdflib') let resourceResponse = {'body': '<rdf:RDF xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:oslc="http://open-services.net/ns/core#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:oslc_am="http://open-services.net/ns/am#" xmlns:ptc_im_am="https://esdcsv-mod-ws01.ptcnet.ptc.com:57850/info/oslc/ns/2.0/am#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <oslc_am:Resource rdf:about="https://esdcsv-mod-ws01.ptcnet.ptc.com:57850/oslc/2.0/servers/ESDCSV-MOD-WS01%40MODELER/repositories/Models/models/oslc1/modelversions/0/am/architecture/1086d995-8d36-4a14-92bf-d6a821ea34fd"> <oslc:serviceProvider rdf:resource="https://esdcsv-mod-ws01.ptcnet.ptc.com:57850/oslc/2.0/servers/ESDCSV-MOD-WS01%40MODELER/repositories/Models/models/oslc1/modelversions/0/am/service/6eeaf055-07be-4e3e-99dd-e1a0e70cb34a" /> <oslc:instanceShape rdf:resource="https://esdcsv-mod-ws01.ptcnet.ptc.com:57850/oslc/2.0/servers/ESDCSV-MOD-WS01%40MODELER/repositories/Models/models/oslc1/modelversions/0/shapes/architecture" /> <rdf:type rdf:resource="http://open-services.net/ns/am#resource" /> <rdf:type rdf:resource="https://esdcsv-mod-ws01.ptcnet.ptc.com:57850/info/oslc/ns/2.0/am#resource" /> <dcterms:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string">1086d995-8d36-4a14-92bf-d6a821ea34fd</dcterms:identifier> <dcterms:title rdf:parseType="Literal">TScreen (Balls) (Package1)</dcterms:title> <oslc:shortTitle rdf:parseType="Literal">TScreen (Balls)</oslc:shortTitle> <dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-10T14:49:02.0000000Z</dcterms:modified> <dcterms:contributor rdf:datatype="http://www.w3.org/2001/XMLSchema#string">PTCNET\\\simoore</dcterms:contributor> <ptc_im_am:dynamicUmlClassName rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Class</ptc_im_am:dynamicUmlClassName> <ptc_im_am:ClassName rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Class</ptc_im_am:ClassName> </oslc_am:Resource> </rdf:RDF>"'} let kb = new rdflib.IndexedFormula() rdflib.parse(resourceResponse.body, kb, "https://esdcsv-mod-ws01.ptcnet.ptc.com:57850/oslc/2.0/servers/ESDCSV-MOD-WS01%40MODELER/repositories/Models/models/oslc1/modelversions/0/am/architecture/1086d995-8d36-4a14-92bf-d6a821ea34fd", 'application/rdf+xml') console.log(JSON.stringify(kb.statements))
Output will contain this additional statement which contains Resource with capital R - ( 3 types are returned )
{ "subject":{ "termType":"NamedNode", "value":"https://esdcsv-mod-ws01.ptcnet.ptc.com:57850/oslc/2.0/servers/ESDCSV-MOD-WS01%40MODELER/repositories/Models/models/oslc1/modelversions/0/am/architecture/1086d995-8d36-4a14-92bf-d6a821ea34fd" }, "predicate":{ "termType":"NamedNode", "value":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type" }, "object":{ "termType":"NamedNode", "value":"http://open-services.net/ns/am#Resource" }, "why":{ "termType":"NamedNode", "value":"https://esdcsv-mod-ws01.ptcnet.ptc.com:57850/oslc/2.0/servers/ESDCSV-MOD-WS01%40MODELER/repositories/Models/models/oslc1/modelversions/0/am/architecture/1086d995-8d36-4a14-92bf-d6a821ea34fd" } }
Attaching the statements json file for the entire output kb_statements.txt
Additional statement for type is getting returned by rdflib.parse In the code snippet below, there are two rdf:type, but rdflib.parse is returning three statements for type. 3 types are getting returned.
Output will contain this additional statement which contains Resource with capital R - ( 3 types are returned )
Attaching the statements json file for the entire output kb_statements.txt