bterlson / cadl-rdfs

A cadl to rdfs emitter
0 stars 0 forks source link

Paulina branch #1

Closed mspaulik closed 1 year ago

mspaulik commented 1 year ago

For range we need to do something like this I think, but I dont know how to write it in TS: :hasResponseType a owl:DatatypeProperty; rdfs:range [ a rdfs:Datatype; owl:oneOf ( "Accept" "Decline" "Provisional" ) ] .

Also, for classes the relationship is 'a' but again, I don't know how to write it in TS, so did DataFactory.namedNode('a'), as an example: :Person a owl:Class ;

mspaulik commented 1 year ago

I tried doing layered structure for range part, however I am not sure how to layer with Quad...

So I am getting an undefined: ex:color owl:DataTypeProperty; rdfs:domain ex:Car; rdfs:range _:undefined;

Maybe we can alter my code slightly to get it to the working solution? I believe its towards the right direction.

bterlson commented 1 year ago

This direction looks good!

I looked into the a issue, and it seems like you can't use the prefix with rdf:type and expect it to give you the a shortcut. Using the full named node (nn("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")) gives you the right behavior. I've pushed a commit to use this as it is porbably uncontroversial.

For the syntax changes you want, I think you just write the quads, and if the n3 library sees you are repeating subjects or subjects+predicates or using blank nodes, it will give you the right syntax. The square brackets indicate you're using a blank node I think, but I have to admit I don't understand what that means as yet.

mspaulik commented 1 year ago

I was trying to model based on this: https://www.w3.org/TR/2005/NOTE-swbp-specified-values-20050517/ and this https://stackoverflow.com/questions/18785499/modelling-owl-datatype-property-restrictions-with-a-list-of-values

mspaulik commented 1 year ago

Hey Brian, its almost working now, I managed to get to this format:

ex:color a owl:DataTypeProperty; rdfs:domain ex:Car; rdfs:range [ a rdfs:Datatype; owl:oneOf "red,blue" ]; skos:note "no superfluous vowels here".

Only thing now, is that instead of owl:oneOf "red,blue" it should be owl:oneOf ("red" "blue" ). Any suggestions on this one? Once this part is fixed, we could merge?

I also, added 'a' definition the way you said - it worked well. And I also added needed namespaces for skos and owl.

bterlson commented 1 year ago

I think with the list syntax solved this is good to merge! There are some formatting issues but I'll get an auto formatter working.

mspaulik commented 1 year ago

I am really struggling to make it work, here is the error if I use writer.list()

image image

bterlson commented 1 year ago

can you push this code so I can take a look? You may need to split that into two calls to addQuad?

mspaulik commented 1 year ago

I actually redid it so color is defined separately as 'DataTypeProperty', please have a look :) This solves 'oneOf' issue I was having. I believe this is also a good solution. If you agree, we can merge

bterlson commented 1 year ago

This seems to work great, thanks a bunch!