Chavdar,

try pasting your data here and validating: https://www.w3.org/RDF/Validator/

<cims:isFixed rdfs:Literal="XYZ" /> is valid RDF/XML syntax, but it
treats rdfs:Literal as a property. Which is most likely not what you
are looking for.

As you can see, it generates an additional triple with a blank node
subject. The blank node has no URI, it has an auto-generated unique ID
instead.
That is probably what you're seeing in Jena as well. But maybe others
can confirm.

What is the "XYZ" value supposed to be in your data? A typed literal?

On Sat, Nov 2, 2019 at 3:10 PM Dr. Chavdar Ivanov <[email protected]> wrote:
>
> Hello
>
> Here the material
> If in the data I have this "<cims:isFixed rdfs:Literal="XYZ" />" then the 
> issue appears. If I change the data to
> "<cims:isFixed rdf:resource="XYZ" />" it works, meaning I do not see the 
> GUIDs in the ModelCom
> It also works if my data is    <cims:isFixed rdf:parseType="Literal">XYZ 
> </cims:isFixed>
> Then in ModelCom I get: ....@cims:isFixed "XYZ 
> "^^http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral...
>
> But it does not work if the data is
> "<cims:isFixed rdfs:Literal="XYZ" />"
> or
> "<cims:isFixed rdfs:resource="XYZ" />"
> Or
> "<cims:isFixed rdf:literal="XYZ" />"
> Or
> "<cims:isFixed rdf:PlainLiteral="XYZ" />"
> Or
> "<cims:isFixed rdf:XMLLiteral="XYZ" />"
>
>
> rdfs:Literal seems explained/defined here: 
> https://www.w3.org/TR/rdf-schema/#ch_literal but maybe the usage is different
>
> The code is
>
> Model model = ModelFactory.createDefaultModel();
> RDFDataMgr.read(model, new FileInputStream("here the file"), Lang.RDFXML);
> for (ResIterator i = model.listSubjects(); i.hasNext(); ) {
>                 Resource resItem = i.next();
>                 try {
>                      String rdfTypeInit = 
> resItem.getRequiredProperty(RDF.type).getObject().toString();
>                     System.out.println(rdfTypeInit);
>                 }catch (Exception e) {
>                     e.printStackTrace();
>                 }
> }
>
> The data is
>
> <?xml version="1.0" encoding="UTF-8"?>
> <rdf:RDF xmlns:cims="http://iec.ch/TC57/1999/rdf-schema-extensions-19990926#"; 
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema#"; 
> xmlns:cim="http://iec.ch/TC57/CIM100#"; 
> xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"; 
> xml:base="http://iec.ch/TC57/CIM100"; >
>    <rdf:Description rdf:about="#Breaker.OperatedBy">
>    <rdfs:label xml:lang="en">OperatedBy</rdfs:label>
>    <rdfs:domain rdf:resource="#Breaker" />
>    <rdfs:range rdf:resource="#ProtectionEquipment" />
>    <cims:inverseRoleName rdf:resource="#ProtectionEquipment.Operates" />
>    <cims:multiplicity 
> rdf:resource="http://www.cim-logic.com/schema/990530#M:0..n"; />
>    <rdfs:comment>"Circuit breakers may be operated by
>        protection relays."</rdfs:comment>
>    <cims:isFixed rdfs:Literal="XYZ" />
>    <rdf:type 
> rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
> </rdf:Description>
>    <rdf:Description rdf:about="#Breaker.OperatedBy">
>    <rdfs:label xml:lang="en">OperatedBy</rdfs:label>
>    <rdfs:domain rdf:resource="#Breaker" />
>    <rdfs:range rdf:resource="#ProtectionEquipment" />
>    <cims:inverseRoleName rdf:resource="#ProtectionEquipment.Operates" />
>    <cims:multiplicity 
> rdf:resource="http://www.cim-logic.com/schema/990530#M:0..n"; />
>    <rdfs:comment>"Circuit breakers may be operated by
>        protection relays."</rdfs:comment>
>    <rdf:type 
> rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
> </rdf:Description>
> </rdf:RDF>
>
> -----Original Message-----
> From: Martynas Jusevičius <[email protected]>
> Sent: Saturday, November 2, 2019 8:17 AM
> To: [email protected]
> Subject: Re: Possible bug in RDFDataMgr
>
> Chavdar,
>
> you should provide a sample of your RDF/XML data.
>
> I don’t think rdfs:Literal attribute is a part of RDF/XML spec. You should 
> provide the literal value simply as text content within the element.
>
> Looks like Jena generates a (blank node?) value instead of the missing one, 
> which might be a bug.
>
> On Sat, 2 Nov 2019 at 07.48, Dr. Chavdar Ivanov <[email protected]>
> wrote:
>
> > Hello,
> >
> >
> >
> > I hit to something strange and I wonder if this is some bug to be fixed.
> >
> >
> >
> > If I read the attached rdf which now has only 2 elements which are the
> > same with the only difference that one has “cims:isFixed”.
> >
> >
> >
> > Below I pasted what I am getting in ModelCom. There are some GUIDs
> > appearing and
> >
> > The iteration of
> > model.listSubjects().next().getRequiredProperty(RDF.*type*) fails as
> >
> > org.apache.jena.shared.PropertyNotFoundException:
> > http://www.w3.org/1999/02/22-rdf-syntax-ns#type
> >
> >
> >
> >
> >
> > If it really a bug and how this could be fixed?
> >
> > It seems it does not related to cims: as there are other cims and it is all 
> > fine with them.
> >
> > <cims:isFixed rdfs:Literal="XYZ" />
> >
> > It seems that rdfs:Literal is not treated.
> >
> >
> >
> > Regards
> >
> > Chavdar
> >
> >
> >
> >
> >
> > The ModelCom is in case there is isFixed in the rdf
> >
> >
> >
> > <ModelCom   {63ded209-84f9-44cf-a61e-7d7ce8b22630 @rdfs:Literal "XYZ";
> > cim:Breaker.OperatedBy @rdf:type rdf:Property; cim:Breaker.OperatedBy
> > @cims:isFixed *63ded209-84f9-44cf-a61e-7d7ce8b22630*;
> > cim:Breaker.OperatedBy @rdfs:comment "\"Circuit breakers may be
> > operated by
> >
> >        protection relays.\""; cim:Breaker.OperatedBy
> > @cims:multiplicity http://www.cim-logic.com/schema/990530#M:0..n;
> > cim:Breaker.OperatedBy @cims:inverseRoleName
> > cim:ProtectionEquipment.Operates; cim:Breaker.OperatedBy @rdfs:range
> > cim:ProtectionEquipment; cim:Breaker.OperatedBy @rdfs:domain
> > cim:Breaker; cim:Breaker.OperatedBy @rdfs:label "OperatedBy"@en} |
> > [*63ded209-84f9-44cf-a61e-7d7ce8b22630*,
> > http://www.w3.org/2000/01/rdf-schema#Literal, "XYZ"] [
> > http://iec.ch/TC57/CIM100#Breaker.OperatedBy,
> > http://www.w3.org/1999/02/22-rdf-syntax-ns#type,
> > http://www.w3.org/1999/02/22-rdf-syntax-ns#Property] [
> > http://iec.ch/TC57/CIM100#Breaker.OperatedBy,
> > http://iec.ch/TC57/1999/rdf-schema-extensions-19990926#isFixed,
> > 63ded209-84f9-44cf-a61e-7d7ce8b22630] [
> > http://iec.ch/TC57/CIM100#Breaker.OperatedBy,
> > http://www.w3.org/2000/01/rdf-schema#comment, "\"Circuit breakers may
> > be operated by
> >
> >        protection relays.\""] [
> > http://iec.ch/TC57/CIM100#Breaker.OperatedBy,
> > http://iec.ch/TC57/1999/rdf-schema-extensions-19990926#multiplicity,
> > http://www.cim-logic.com/schema/990530#M:0..n] [
> > http://iec.ch/TC57/CIM100#Breaker.OperatedBy,
> > http://iec.ch/TC57/1999/rdf-schema-extensions-19990926#inverseRoleName
> > , http://iec.ch/TC57/CIM100#ProtectionEquipment.Operates] [
> > http://iec.ch/TC57/CIM100#Breaker.OperatedBy,
> > http://www.w3.org/2000/01/rdf-schema#range,
> > http://iec.ch/TC57/CIM100#ProtectionEquipment] [
> > http://iec.ch/TC57/CIM100#Breaker.OperatedBy,
> > http://www.w3.org/2000/01/rdf-schema#domain,
> > http://iec.ch/TC57/CIM100#Breaker] [
> > http://iec.ch/TC57/CIM100#Breaker.OperatedBy,
> > http://www.w3.org/2000/01/rdf-schema#label, "OperatedBy"@en]>
> >
> >
> >
> >
> >
> > If I delete the isFixed the result is
> >
> > <ModelCom   {cim:Breaker.OperatedBy @rdf:type rdf:Property;
> > cim:Breaker.OperatedBy @rdfs:comment "\"Circuit breakers may be
> > operated by
> >
> >        protection relays.\""; cim:Breaker.OperatedBy
> > @cims:multiplicity http://www.cim-logic.com/schema/990530#M:0..n;
> > cim:Breaker.OperatedBy @cims:inverseRoleName
> > cim:ProtectionEquipment.Operates; cim:Breaker.OperatedBy @rdfs:range
> > cim:ProtectionEquipment; cim:Breaker.OperatedBy @rdfs:domain
> > cim:Breaker; cim:Breaker.OperatedBy @rdfs:label "OperatedBy"@en} |  [
> > http://iec.ch/TC57/CIM100#Breaker.OperatedBy,
> > http://www.w3.org/1999/02/22-rdf-syntax-ns#type,
> > http://www.w3.org/1999/02/22-rdf-syntax-ns#Property] [
> > http://iec.ch/TC57/CIM100#Breaker.OperatedBy,
> > http://www.w3.org/2000/01/rdf-schema#comment, "\"Circuit breakers may
> > be operated by
> >
> >        protection relays.\""] [
> > http://iec.ch/TC57/CIM100#Breaker.OperatedBy,
> > http://iec.ch/TC57/1999/rdf-schema-extensions-19990926#multiplicity,
> > http://www.cim-logic.com/schema/990530#M:0..n] [
> > http://iec.ch/TC57/CIM100#Breaker.OperatedBy,
> > http://iec.ch/TC57/1999/rdf-schema-extensions-19990926#inverseRoleName
> > , http://iec.ch/TC57/CIM100#ProtectionEquipment.Operates] [
> > http://iec.ch/TC57/CIM100#Breaker.OperatedBy,
> > http://www.w3.org/2000/01/rdf-schema#range,
> > http://iec.ch/TC57/CIM100#ProtectionEquipment] [
> > http://iec.ch/TC57/CIM100#Breaker.OperatedBy,
> > http://www.w3.org/2000/01/rdf-schema#domain,
> > http://iec.ch/TC57/CIM100#Breaker] [
> > http://iec.ch/TC57/CIM100#Breaker.OperatedBy,
> > http://www.w3.org/2000/01/rdf-schema#label, "OperatedBy"@en]>
> >

Reply via email to