rdfs

zoj 4124 "Median" (思维?假的图论?)

℡╲_俬逩灬. 提交于 2020-05-04 07:15:27
传送门 来源:2019 年“浪潮杯”第十届山东省 ACM 省赛 题意:   对于一个包含n个数的(n为奇数)序列val[ ],排序后的 val[ (n+1) / 2 ] 定义为 median;   有 n 个数,并有 m 组关系,对于第 i 组关系 a i ,b i 代表第 val[a i ] > val[b i ];   但并没有给出具体的数值;   输出一个包含 n 个元素的数组 s[ ] ;   让你判断第 i 个数 val[ i ]是可能为中位数,如果是,第 i 位为 1;   如果不是,第 i 位为 0;   输出 n 个数,其中第 i 个数为 0 或 1,含义如上; 题解:   首先,特判两种情况:     ①a i = b i ;     ②给出的 m 个关系有环;   对于这两种情况,输出 n 个 0;   除了这两种情况外,就是一个有向无环图;   如何判断第 i 位是否为 median 呢?   搜索:   正向搜索比第 i 个数小的数的总个数 tot1;   反向搜索比第 i 个数大的数的总个数 tot2;   那么,还剩下 res = n-(tot1+tot2+1) 个数;   如果 res ≥ |tot1-tot2|,那么第 i 个数就是中位数; AC代码: 1 #include<bits/stdc++.h> 2 using namespace std;

How can one extract rdf:about or rdf:ID properties from triples using SPARQL?

China☆狼群 提交于 2020-02-02 11:21:08
问题 It seemed a trivial matter at the beginning but so far I have not managed to get the unique identifier for a given resource using SPARQL. What I mean is given, e.g., rdf:Description rdf:about="http://..." and then some properties identifying this resource, what I want to do is to first find this very resource and then retrieve all the triples given some URI. I have tried naïve approaches by writing statements in a WHERE clause such as: ?x rdf:about ?y and ?x rdfs:about ?y I hope I am being

Inference on Complex Classes in Protege

末鹿安然 提交于 2020-01-13 12:09:27
问题 I want to make inferences such as the property represented by the grey-dotted line in this diagram: I have asserted a general axiom: (hasTaste some Bitter) SubClassOf: goesWellWith some (hasTaste some Sweet) where 'bitter' is of type Bitter and 'sweet' is of type Sweet. I thought owl:someValuesFrom (or Manchester's "some") meant that at least one such relation must exist. Yet this does not happen after making the bold diagram assertions and the general axiom. How can I make this work? EDIT

Inference on Complex Classes in Protege

折月煮酒 提交于 2020-01-13 12:09:16
问题 I want to make inferences such as the property represented by the grey-dotted line in this diagram: I have asserted a general axiom: (hasTaste some Bitter) SubClassOf: goesWellWith some (hasTaste some Sweet) where 'bitter' is of type Bitter and 'sweet' is of type Sweet. I thought owl:someValuesFrom (or Manchester's "some") meant that at least one such relation must exist. Yet this does not happen after making the bold diagram assertions and the general axiom. How can I make this work? EDIT

jena api get range of ObjectProperty

我的梦境 提交于 2020-01-06 15:24:06
问题 I've and OWL file and I can explore it and navigate through classes and properties but I can't retrieve correct range of ObjectProperty. This is part of my OWL file: <owl:ObjectProperty rdf:about="&aat;aat2209_located_in"> <rdfs:label xml:lang="en">located in</rdfs:label> <rdfs:label xml:lang="it">si trova in</rdfs:label> <rdfs:comment xml:lang="en">The property defines a relationship between places or places and things</rdfs:comment> <rdfs:comment xml:lang="it">La proprietà definisce la

Trouble Inferring Properties for Classes/Individuals in Protege 5/OWL

佐手、 提交于 2020-01-06 03:45:10
问题 I want to be able to infer which ingredients go well together given...their properties and which properties complement each other. I have an ontology like, owl:Thing Ingredient Kale Pear Taste Bitter Sweet owl:topObjectProperty hasTaste tasteComplements goesWellWith Individuals: (*would rather work with just classes) kale a Kale pear a Pear bitter a Bitter sweet a Sweet I've asserted, Kale subClassOf hasTaste some Bitter Pear subClassOf hasTaste some Sweet Bitter subClassOf tasteComplements

How do owl and rdfs property domain range work?

五迷三道 提交于 2020-01-03 04:16:35
问题 I am trying to understand the semantics of rdfs domain and range. Because I am from an object oriented background, I am struggling to understand the semantics and how to validate data against the rdfs statements. Here is a sample file in turtle format: PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix tmpl: <http://template.example.com/> prefix data: <http://data.example.com/> tmpl

RDF Schema - how to create instances?

╄→гoц情女王★ 提交于 2020-01-02 09:58:47
问题 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

RDFS: same property for multiple domains

房东的猫 提交于 2020-01-01 07:03:32
问题 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? 回答1: You can in

RDF Graph Entailment

狂风中的少年 提交于 2019-12-30 06:20:29
问题 I just read about the concept of entailment for RDF (Resource Description Framework).Can anyone tell me an example of entailment for two RDF graphs and explain them a bit. Thanks 回答1: Suppose you have the following : ex:book1 rdf:type ex:Publication . ex:book2 rdf:type ex:Article . So a Sparql query like SELECT ?s { ?s rdf:type ex:Publication } will return only ex:book1 If you add the fact (or a graph in your data set with the fact) that states : ex:Article rdfs:subClassOf ex:Publication If