rdf

2024-05-17T13:33:55.922469Z

Small point but IIRC there are some edge cases that mean this isn’t true. I’m pretty sure there are some syntactic constraints in RDF/XML that mean it’s not actually able to represent all valid RDF graphs. IIRC it was something to do with predicates and the presence of particular characters in URIs, that meant the xml would be invalid. It was an edge case for sure, but I do remember it causing problems when processing some 3rd party data. It was a long time ago now, so I might be misremembering.

2024-05-17T13:35:25.751389Z

ahh here it is: https://www.w3.org/TR/REC-rdf-syntax/#section-Serialising

2024-05-17T13:35:59.079659Z

TLDR: avoid using RDF/XML unless you need it for legacy reasons.

quoll 2024-05-17T14:22:19.805619Z

We were using QNames for RDF/XML reasons (because some data comes to us that way), but switching to CURIES has made life so much easier. For instance, the SNOMED-CT IRI for for the Common Cold is http://snomed.info/id/82272006. This can't be represented as a QName, but it shows up as a CURIE just fine:

@prefix sct: <>

sct:82272006 rdfs:label "Common cold (disorder)"@en .
This is clearly a lot more convenient. More importantly, SNOMED-CT properties look like this as well:
sct:47429007 rdf:type owl:ObjectProperty ;
             rdfs:subPropertyOf sct:762705008 ;
             rdfs:label "Associated with (attribute)"@en ;
             skos:prefLabel "Associated with"@en .
This encodes into an RDF/XML ontology just fine, since it will only appear as a subject or object, but it can't be used in RDF/XML.

quoll 2024-05-17T14:49:47.885159Z

To expand on it, here is the RDF/XML for the OWL of that property:

<owl:ObjectProperty rdf:about="">
        <rdfs:subPropertyOf rdf:resource=""/>
        <rdfs:label xml:lang="en">Associated with (attribute)</rdfs:label>
        <skos:prefLabel xml:lang="en">Associated with</skos:prefLabel>
    </owl:ObjectProperty>

quoll 2024-05-17T14:50:52.652929Z

That seems OK, because SNOMED-CT is all OWL EL, and it’s really about the description logic, rather than suggesting that anyone create instance data that uses these properties

quoll 2024-05-17T15:04:27.771429Z

But to get this example I tried to generate the RDF/XML for SNOMED-CT, and it turns out that the library I was using (based on OWLAPI) refuses to do the conversion. It allows most of the properties to be described in OWL, but refuses to convert the 3 annotation properties:

sct:1295447006 rdfs:label "Annotation attribute (attribute)"@en .
sct:1295448001 rdfs:label "Attribution (attribute)"@en . 
sct:1295449009 rdfs:label "Additional relationship attribute (attribute)"@en .
These could be converted, and maybe a more recent version of OWLAPI would do it, but this is clearly a problem.

quoll 2024-05-17T15:05:03.370629Z

i.e. Use TTL because it supports CURIEs

💯 1
quoll 2024-05-17T15:05:32.380329Z

Also, SPARQL and TTL share syntax on this, so that’s another reason to like TTL

💯 1
quoll 2024-05-17T16:57:09.565919Z

maybe a more recent version of OWLAPI would do itI just tried. The answer is “no”. Maybe I should contribute a fix to https://github.com/owlcs/owlapi. Then again… it’s Java. Do I really want to do that to myself? 🙂

2024-05-17T22:16:42.471249Z

I actually think RDF/XML is kind of a corner case now... back in the day I thought I could drop it inside a SOAP envelope as the payload, but that turned into a nightmare. so these days I think I'd rather write a little XML wrapper piece of code than let RDF/XML jump out of an abstraction 😄

quoll 2024-05-17T22:25:21.275559Z

Back in the day… many people were dismissing RDF as “just an XML schema”. People couldn’t understand why you’d want to encode your data in such an obscure way when you could just go straight to XML much more easily. It was only a short time after XML had been announced, and the W3C was keen to show everyone that anything could be encoded with it, hence the first (and for many years, the only) file standard was RDF/XML. But the conflation of RDF with XML was one of the biggest impediments to people understanding or adopting RDF.

☝️ 1