rdfs

Explain inference in Jena

南楼画角 提交于 2019-12-06 06:51:39
In Jena, I have created an RDFS inference model using InfModel class: InfModel infmodel = ModelFactory.createRDFSModel(schema, data); Given an inferred statement from infmodel, how do we get the two statements that were used to infer it, similar to the the "explain inference" option in Protégé? For instance, if infModel contains the statement :a rdf:type :t , we might get two statements used to infer it, e.g., :a :p :b and :p rdfs:domain :t . According to the documentation (and testing with Jena 2.11.1) you can get access to a Derivation object which will allow you to create a textual

RDF Schema - how to create instances?

六月ゝ 毕业季﹏ 提交于 2019-12-06 06:29:04
I want to have instances of classes in my RDFS file, but I don't know how to do it. My class: <rdfs:Class rdf:ID="Turns"> <rdfs:range rdf:resource="Literal"/> </rdfs:Class> My property: <rdf:Property rdf:ID="has_Turns"> <rdfs:domain rdf:resource="#Device"/> <rdfs:range rdf:resource="#Turns_Frequency"/> </rdf:Property> I want to get an instance of class "Turns" with a "has_Turns" property. I tried something like this: <Turns_Instance rdf:ID="Turns">…</Turns_Instance> … but it takes that the main class is "Turns_Instance", the other way round it doesn't work. What's more I don't know where to

SPARQL query to find all sub classes and a super class of a given class

爷,独闯天下 提交于 2019-12-06 04:30:50
问题 I need to write a SPARQL query to find a superclass/subclasses of a given class. For example, given http://139.91.183.30:9090/RDF/VRP/Examples/Phenomenon.rdf RDFS vocabulary file, I want to find the superclass of 'AcousticWave' (which is 'Wave'). Similarly if user enters 'Wave', I want to get all sub classes of 'Wave' (which are 'AcousticWave', 'GravityWave', 'InternalWave' and Tide'). How would I write such SPARQL query? 回答1: The predicate used in rdfs for state sub/super class relationships

How to validate a RDF with your RDF schema

拈花ヽ惹草 提交于 2019-12-05 16:20:59
I'm using the Jena framework to manipulate RDF files, but I can't find a way to validate a RDF with your respective RDFSchema. I'm trying this method bellow: Model mod1 = new ModelMem(); Model modSchema = new ModelMem(); String baseURI = "http://iec.ch/TC57/2007/network"; String rdfPath = "file:D:\\modelo.rdf"; InputStream model = FileManager.get().open(rdfPath); String rdfPathSchema = "file:D:\\Schema.rdf"; InputStream modelSchema = FileManager.get().open(rdfPathSchema); mod1.read(model, baseURI, "RDF/XML-ABBREV"); modSchema.read(modelSchema,baseURI, "RDF/XML-ABBREV"); InfModel infmodel =

SPARQL query to find all sub classes and a super class of a given class

半腔热情 提交于 2019-12-04 10:08:28
I need to write a SPARQL query to find a superclass/subclasses of a given class. For example, given http://139.91.183.30:9090/RDF/VRP/Examples/Phenomenon.rdf RDFS vocabulary file, I want to find the superclass of 'AcousticWave' (which is 'Wave'). Similarly if user enters 'Wave', I want to get all sub classes of 'Wave' (which are 'AcousticWave', 'GravityWave', 'InternalWave' and Tide'). How would I write such SPARQL query? The predicate used in rdfs for state sub/super class relationships is rdfs:subClassOf . With that in mind you just need to write triple patterns in your SPARQL query that

restrict xsd:string to [A-Z] for rdfs:range

ⅰ亾dé卋堺 提交于 2019-12-04 04:48:59
How can I specify the range of a datatype property to be xsd:strings whose literal forms match [A-Z]? OWL restrictions don't do the trick for me, at least at first glance. Is there a way to do this with regular expressions and if so, where? I suppose you mean "single capital letter" which is string[pattern "[A-Z]"] . If you are using Protege, enter this into the "Data range expression" tab. HermiT 1.3.7 can check this and provide explanations about inconsistent property values. Other answers have explained that this can be done using the XSD facets to restrict the string range of the property

Using the 'GRAPH' keyword in SPARQL to fetch remote graphs

不羁的心 提交于 2019-12-04 04:18:10
I'm looking to use SPARQL for a relatively basic task: Given a FOAF graph, I'd like to parse the elements I find in there, get their tags (if they exist) and then, use those as new graphs from which to find information about those people. So for instance, you could imagine a simple use case where I want to run a SPARQL query to list all of my favorite foods (as per my FOAF file), and also the favorite foods of all my friends. Here is what this looks like at the moment. Note that for testing purposes, at the moment all I'm trying to do with the query below is fetch the name of the friend,

RDFS: same property for multiple domains

吃可爱长大的小学妹 提交于 2019-12-03 21:54:51
I have an RDFS ontology with two completely separate classes: User and Venue . I want them both to have names which are provided through a property called hasName , which for a User should look similar to: <rdf:Property rdf:ID="hasName"> <rdfs:comment> Comment here. Blah blah blah. </rdfs:comment> <rdfs:domain rdf:resource="#user"/> <rdfs:range rdf:resource="Literal"/> </rdf:Property> However, if I want it for a Venue as well, it doesn't validate. How should I approach this? You can in principle just specify multiple domain properties: <rdf:Property rdf:ID="hasName"> <rdfs:domain rdf:resource=

Difference between domain and range in rdf schema?

前提是你 提交于 2019-12-02 23:35:46
could you please explain me the difference between rdfs:domain and rdfs:range with an example? and when should i use domain and when range? i have read h w3c rdf primer but i did not understand the difference William Greenly From a simplistic point of view, the domain and range properties are there to give you insight into the way that the property links a subject to an object. In the case of the domain property , when you link a subject to an object using a property with this associated attribute, then the subject qualifies as a type of thing specified in the domain. For example, we look at a

It is possible to use aggregate function when inserting data in SPARQL?

旧时模样 提交于 2019-12-02 09:43:55
问题 I have the following query which aims to prevent the insertion in a named graph when the amount of triples is of a given number, e.g., 5. I tried to reproduce the example showed here where the insertion of data is possible but I need to use the same named graph and, most important an aggregate function, i.e., COUNT. INSERT { GRAPH <http://example/g1> { ?s ?p ?o } } WHERE { GRAPH <http://example/g1> { ?s ?p ?o . FILTER ( COUNT(?p) < 5) } } Jena Fuseki raises the following error: Aggregate