Is there a shortcut to create a class in the ontology language N3 / Turtle

Here is how I know to create a class in N3:

:Person a rdfs:Class. 

And here's how to indicate that a particular ressource is an instance of this class:

 :Pat a :Person. 

Problem . I want to create a class with over 20,000 instances (with software). Record of all :Pat a :Person. for my 20,000 instances makes the ontology file verbose.

Question : Is there any work to make the file smaller?

+4
source share
2 answers

You can define a custom prefix for the full class URI, and then just use the prefix to refer to the class:

 @prefix : <http://example.com/myOntology#>. @prefix x: <http://example.com/myOntology#MyClass>. :Alice ax: . :Bob ax: . :Charlie ax: . 

This is not entirely clear, but as short as possible.

I agree with Antoine that there is little point in this trick. Disk space is cheap, and this material is well compressed for network transfer, and for processing in the application it will expand anyway.

+2
source

If you really use N3, not Turtle (which I doubt), you can use the @is ... @of , for example:

 :Person a rdfs:Class; @is a @of :Pat, :Bob, :Chris, :Cindy, :Suzy . 

There is hardly any Turtle toolkit that allows this.

There was also a long discussion thread in public-rdf-comments@w3.org Mail Archives about adding this feature to Turtle (which is currently being published by W3C as a working draft for the last call), starting with a comment by Tim Berners-Lee . Then Dave Beckett's comment went, in which he asked not to include this function and a long thread. Then came a good summary of the positions with commentary by the editor of Gavin Carothers , editor of the Turtle specification in the current RDF working group.

However, I doubt that this will become a feature of the Turtle when it is eventually standardized.

By the way, what is the problem with 20,000 records when all this is generated (and, I think, analyzed) programmatically? If you need to exchange so much data over a network, you can easily compress it. Or you can use compact serialization syntax like HDT , but there are several implementations.

+6
source

All Articles