这是我的查询
PREFIX : <http://example.org/rs#>
select ?item (SUM(?similarity) as ?summedSimilarity)
(group_concat(distinct ?becauseOf ; separator = " , ") as ?reason) where
{
values ?x {:instance1}
{
?x ?p ?instance.
?item ?p ?instance.
?p :hasSimilarityValue ?similarity
bind (?p as ?becauseOf)
}
union
{
?x a ?class.
?item a ?class.
?class :hasSimilarityValue ?similarity
bind (?class as ?becauseOf)
}
filter (?x != ?item)
}
group by ?item
Run Code Online (Sandbox Code Playgroud)
在我的第一bind个子句中,我不仅要绑定变量?p,还要绑定变量?instance。另外,添加像that is why.
所以第一次绑定应该导致以下结果:
?p that is why ?instance …
我的问题是在开发本体时是否必须遵循任何本体方法?
按照我的理解:
请逐点评论/指导我。谢谢。
我需要在树中循环以获取所有可能的路径,我的代码中的问题是我只得到第一个路径!
在图中,有 2 个路径 t 句柄: 1-2-3-4-5-6 和 1-2-3-7-8 ,但我无法同时获取这两个路径,我刚刚检索了 1-2-3 -4-5-6!
我的代码:
主要内容:
for (String key : synset.keySet()) { // looping in a hash of Concept and it's ID
System.out.println("\nConcept: " + key + " " + synset.get(key));
List<Concept> ancts = myOntology.getConceptAncestors(myOntology.getConceptFromConceptID(synset.get(key))); // this function retreives the root of any node.
for (int i = 0; i < ancts.size(); i++) {
System.out.print(ancts.get(i).getConceptId() + " # ");
System.out.print(getChilds(ancts.get(i).getConceptId()) + " -> "); // here, the recursive function is needed …Run Code Online (Sandbox Code Playgroud) 我有一个类Movie,其中有像 2515159 这样的代表电影的实例,还有一个名为 的类Country,其中有像英国、美国、意大利、奥地利和其他国家这样的实例。我还有一个hasCountry与电影中的国家相匹配的角色,例如:
2515159 hasCountry Italy
2515159 hasCountry Austria
Run Code Online (Sandbox Code Playgroud)
(一部电影可以有多个国家)
现在的问题是:
我想创建一个MovienameEuropeanMovie,其中包含仅拥有欧洲国家的个人的实例。
在 protege 创建名为 EuropeanMovie 的 Movie 子类后,我尝试将“等效项”放置为:
Movie and hasCountry only {Austria,Italy, ...all the EU countries...}
Run Code Online (Sandbox Code Playgroud)
还尝试过:
Movie
and hasCountry some (
{Austria,Italy, ...all the EU countries...}
and not {USA, and other non EU countries...} )
Run Code Online (Sandbox Code Playgroud)
但是,上面仅使用关键字不会返回任何内容,而有仅包含欧盟国家的电影(如开头的示例)。
经过大量搜索后,我没有找到太多,但我认为这可能与猫头鹰的开放世界假设有关,但我不明白这一点。
如果有人能给任何建议,那将非常有帮助,谢谢!
是否有任何函数可以使用 SPARQL 从两个不同的类中求和和减去两个数字(整数或长数据类型)?如何使用它 ?
我用 Protege 创建了一个本体,并将其保存为.owl文件。
当我尝试通过 Workbench Import -> RDF -> Upload RDF files将其加载到 GraphDB (8.9.0) 时(支持的 RDF 格式为 .ttl .rdf .rj .n3 .nt .nq .trig .trix .brf .owl .jsonld,以及它们的 .gz 版本和 .zip 档案)我收到错误:
RDF Parse Error: Content is not allowed in prolog. [line 1, column 1]。
完整日志:
01:00:37.877 [import-task-Accounting-1] ERROR o.e.r.rio.helpers.ParseErrorLogger - [Rio fatal] Content is not allowed in prolog. (1, 1)
01:00:37.879 [import-task-Accounting-1] ERROR c.o.f.impex.FileImportRunnableTask - RDF Parse Error
org.eclipse.rdf4j.rio.RDFParseException: Content is not allowed in …Run Code Online (Sandbox Code Playgroud) 在一个.owl文件中,我声明了一些前缀,如下所示:
Prefix(:=<http://default.ont/my_ont/>)
Prefix(ex:=<http://example.org/ex#>)
Prefix(ex2:=<http://example2.org/ex#>)
...
Run Code Online (Sandbox Code Playgroud)
在 Java 项目中使用我的本体,如下所示:
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLOntology ontology = manager.loadOntologyFromOntologyDocument(new File(resourceFullPath(ontologyFilename)));
Run Code Online (Sandbox Code Playgroud)
现在我想Map<String, String>以编程方式构建一个包含以下内容的程序:
{
"" -> "http://default.ont/my_ont/",
"ex" -> "http://example.org/ex#",
"ex2" -> "http://example2.org/ex#"
}
Run Code Online (Sandbox Code Playgroud)
我如何使用OWL API执行此操作(即无需.owl自己解析文件)?
我开始深入研究“知识图谱”这个主题,我感觉这和“链接开放数据”是一样的。我有一些问题 1)如果是这样,为什么他们需要发明一个新概念。2)如果不是,有什么区别以及本体论与它有什么关系?3)这一切是如何与神经网络联系起来的?
我希望这些问题的答案能够澄清概念并指明方向。
这是我的第一堂课Ratings2016,它是一个等同的类:评级和createdOn的值大于2016.
<!-- http://semanticrecommender.com/rs#Ratings2016 -->
<owl:Class rdf:about="http://semanticrecommender.com/rs#Ratings2016">
<owl:equivalentClass>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<rdf:Description rdf:about="http://semanticrecommender.com/rs#Rates"/>
<owl:Restriction>
<owl:onProperty rdf:resource="http://semanticrecommender.com/rs#createdOn"/>
<owl:someValuesFrom>
<rdfs:Datatype>
<owl:onDatatype rdf:resource="http://www.w3.org/2001/XMLSchema#dateTime"/>
<owl:withRestrictions rdf:parseType="Collection">
<rdf:Description>
<xsd:minInclusive rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2016-01-01T00:00:00</xsd:minInclusive>
</rdf:Description>
</owl:withRestrictions>
</rdfs:Datatype>
</owl:someValuesFrom>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
</owl:equivalentClass>
</owl:Class>
Run Code Online (Sandbox Code Playgroud)
这是另一个类,Ratings2015它相当于评级,并且比2015年更大
<!-- http://semanticrecommender.com/rs#Ratings2015 -->
<owl:Class rdf:about="http://semanticrecommender.com/rs#Ratings2015">
<owl:equivalentClass>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<rdf:Description rdf:about="http://semanticrecommender.com/rs#Rates"/>
<owl:Restriction>
<owl:onProperty rdf:resource="http://semanticrecommender.com/rs#createdOn"/>
<owl:someValuesFrom>
<rdfs:Datatype>
<owl:onDatatype rdf:resource="http://www.w3.org/2001/XMLSchema#dateTime"/>
<owl:withRestrictions rdf:parseType="Collection">
<rdf:Description>
<xsd:minInclusive rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2015-01-01T00:00:00</xsd:minInclusive>
</rdf:Description>
</owl:withRestrictions>
</rdfs:Datatype>
</owl:someValuesFrom>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
</owl:equivalentClass>
</owl:Class>
Run Code Online (Sandbox Code Playgroud)
当我运行推理器时,推理者称Ratings2016是2015年评级的子类
这是不正确的,为什么会这样,如何解决?
在RDF/OWL中,属性和属性的含义是相同的,还是不同?
ontology ×10
owl ×5
semantic-web ×4
protege ×3
rdf ×3
java ×2
sparql ×2
graphdb ×1
linked-data ×1
methodology ×1
namespaces ×1
owl-api ×1
prefix ×1
rdfs ×1
recursion ×1
terminology ×1
tree ×1
wordnet ×1