Извлечение данных из файла Turtle с использованием ARC2

Поэтому я использую PHP-библиотеку ARC2, чтобы попытаться получить данные из локально сохраненного файла Turtle для отображения списка людей.
К сожалению, он создает только пустой массив, и я не уверен, где я ошибаюсь.
Я только начал работать с этим, поэтому я, вероятно, упускаю что-то очевидное, если кто-нибудь может указать мне правильное направление.

Мой код

<?php

include_once("arc2/ARC2.php");
?>
<html>
<head>
<title>Basic FOAF example</title>
</head>
<body>
<?php
$parser = ARC2::getTurtleParser();
$parser->parse('relatives.ttl');
$triples = $parser->getTriples();

if ($triples){
for ($i = 0, $i_max = count($triples); $i < $i_max; $i++) {
$triple = $triples[$i];
echo ($triple);
}
}
else {
echo ('No Data');
}

?>

</body>
</html>

Данные Turtle хранятся в локальном файле с именемlatives.ttl и имеют следующий вид

@prefix : <http://example.org/relatives#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://example.org/relatives> .

<http://example.org/relatives> rdf:type owl:Ontology .

#################################################################
#    Object Properties
#################################################################

###  http://example.org/relatives#hasChild
:hasChild rdf:type owl:ObjectProperty ;
owl:inverseOf :hasParent .


###  http://example.org/relatives#hasGrandparent
:hasGrandparent rdf:type owl:ObjectProperty ;
owl:propertyChainAxiom ( :hasParent
:hasParent
) .


###  http://example.org/relatives#hasParent
:hasParent rdf:type owl:ObjectProperty ;
rdfs:subPropertyOf :hasAncestor .


###  http://example.org/relatives/hasAncestor
:hasAncestor rdf:type owl:ObjectProperty ,
owl:TransitiveProperty .


#################################################################
#    Classes
#################################################################

###  http://example.org/relatives#Child
:Child rdf:type owl:Class ;
rdfs:subClassOf :Person .


###  http://example.org/relatives#Parent
:Parent rdf:type owl:Class ;
rdfs:subClassOf :Person .


###  http://example.org/relatives#Person
:Person rdf:type owl:Class .


#################################################################
#    Individuals
#################################################################

###  http://example.org/relatives#Aaron
:Aaron rdf:type owl:NamedIndividual .


###  http://example.org/relatives#Ann
:Ann rdf:type owl:NamedIndividual ,
:Person .


###  http://example.org/relatives#Bill
:Bill rdf:type owl:NamedIndividual ,
:Person .


###  http://example.org/relatives#Bob
:Bob rdf:type owl:NamedIndividual ,
:Person ;
:hasParent :Bill .


###  http://example.org/relatives#Cathy
:Cathy rdf:type owl:NamedIndividual ,
:Person ;
:hasParent :Bill .


###  http://example.org/relatives#Fred
:Fred rdf:type owl:NamedIndividual ,
:Person ;
:hasChild :James ;
:hasParent :Cathy .


###  http://example.org/relatives#Jacob
:Jacob rdf:type owl:NamedIndividual ,
:Person ;
:hasParent :Fred .


###  http://example.org/relatives#James
:James rdf:type owl:NamedIndividual ,
:Person .


###  http://example.org/relatives#James2
:James2 rdf:type owl:NamedIndividual ,
:Person ;
:hasChild :John .


###  http://example.org/relatives#John
:John rdf:type owl:NamedIndividual ,
:Person ;
:hasChild :Mary ,
:Michael ;
:hasParent :James2 .


###  http://example.org/relatives#Mary
:Mary rdf:type owl:NamedIndividual ,
:Person .


###  http://example.org/relatives#Michael
:Michael rdf:type owl:NamedIndividual ,
:Person ;
:hasParent :John .


###  http://example.org/relatives#Simon
:Simon rdf:type owl:NamedIndividual ,
:Person ;
:hasParent :Michael .


###  http://example.org/relatives#Tim
:Tim rdf:type owl:NamedIndividual ,
:Person ;
:hasParent :Simon ,
:Valerie .


###  http://example.org/relatives#Valerie
:Valerie rdf:type owl:NamedIndividual ,
:Person .


###  http://example.org/relatives#Victor
:Victor rdf:type owl:NamedIndividual ,
:Person .

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector