I have created virtual graph in my system using a DB in SQL server. The graph got generated and I can query on that.
Now I extracted that graph in to a rdf/ttl format but there are certain things that I am unable to understand:
All the columns defined in the database appear as annotated property rather than actual object property or data property. Because they appear as annotated property I can not execute SPARQL over the same using any other tool like Protege or TBC. Would you please help me if we can do it other way by any means?
Also I can see individual instances are generated using nodes and they appear as :
Where every individual is treated as node and details attache dto those nodes are given in description. Is there any way if we can get these nodes as OWL:individual so that it becomes more generic how the rdfs/ttls are created.
I’m not understanding what you’re saying about annotation properties. This is a classification of properties that is defined in your ontology, not in the virtual graph mapping. Can you give an example of where you see this?
Regarding the individuals, each node will be treated as individual if it is not a property or class (or OWL axiom construct).
As Jess said, if the properties are treated as annotation properties, this is an issue in your ontology. Protege is based on OWL API, the type of properties has to be declared explicitly in RDF/XML, otherwise the parser would have to guess. Declaration axioms are the way to go.
By the way, even if those properties would be annotation properties, on an RDF level nothing would have been changed, thus, SPARQL would be even possible in Protege as long as you use the default SPARQL tab (which is based on RDF4J)
Hi Jess and Lorenz,
Thank you for the response. I will explain my doubt once again, I think I was not clear.
I created a virtual graph from Database and then I added generated mappings to a ttl file using: stardog-admin virtual mappings --format r2rml myDB> myDB.ttl
Then I created a stardog DB using the same ttl file as reference as: stardog-admin db create -n myDB myDB.ttl
Then I copied triples from DB for data using command: stardog-admin virtual import myDB C:\startdog\data\DB.properties myDB.ttl --format r2rml
and then I extracted this stardoig DB created with data from database to a rdf file using: stardog data export --format RDFXML myDB Database.rdf
This Database.rdf created out of stardog database(which was created automatically using stardog) has column names as annotated properties. I wanted to understand if there are any other steps that I can follow that created these column names as object and data properties in rdf generated.
Also, in the same process, each row of database table which acts as an instance of that table class, comes as description as mentioned previously. As per my understanding each row is like an instance of the table and it should come as owl:NamedIndividual, so is there any way that we can get these data as named individuals rather than as description like i am getting right now.
Thanks for the data. I don’t see any annotation property characterizations here. Perhaps the RDF representation in XML is not clear? Have you tried Turtle/TTL format? Can you give a specific example of what you are calling an annotation property?
It looks the same even if I create a ttl file from the same.
If you try opening this file in Protege you will be able to see all column names as annotated properties.
Also, if you scroll down in the same file, you will be able to see description tags which should have been owl:namedIndividuals as per my understanding.
Protege appears to be making the assumption that these properties are annotation properties because they are not otherwise defined in your ontology. You should add object/datatype property definitions as appropriate.
Regarding OWL named individuals, this will be inferred at reasoning time.
You should add object/datatype property definitions as appropriate. : Where and how should I add object/datatype property definitions? Regarding OWL named individuals, this will be inferred at reasoning time : I tried reasoning in Protege but it did not work. Did you mean reasoning from Stardog?
Thank you!
Regards,
Smrati
I don’t see any particular problems with these commands but I cannot say that it’s “correct” without know all the details of your use case and requirements. Why are you running the virtual import twice?
As i don’t have a .ttl file which has the design of the database.
First time it copies the structure or the database design. While second time using the ttl file that we get after first virtual add, it fetches data from the database and adds description tags.
It is not necessary to do virtual import if wish to query over the relational database at runtime. Further, exporting to RDF is not necessary. Stardog stores data in indexed form and you can query directly with Stardog, including reasoning.
Regarding the property types: That's what I said in my previous comment. In OWL properties have to be typed, otherwise, a parser is lost. Consider e.g. a dataset and a property p just used with string values, how should a parser decide on the type? Clearly, for OWL specific serialization formats like OWL Functional Syntax, Manchester Syntax this problem won't occur as all elements are strongly typed.
Jess already provided the solution, always add triples for each schema entity.