Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: RDF/XML czym przetworzyć
Forum PHP.pl > Forum > XML, AJAX > XML
mirkus
Witam mam pytanie związane z xml a dokładnie RDF/XML. Chce go przekształcić w czysty XML. Może ktoś miał z tym doczynienia ja próbowałem zrobić w php wyciaganie parametrów poprzez funkcje preg_match ale zdaje to rozwiązanie w przypadku prstych rdf-ów. Może przekształcal już RDF/XML i może podpowie jak go ugryść:

oto przykładowy plik RDF/XML:
Kod
<?xml version="1.0"?>
<!DOCTYPE rdf:RDF [
    <!ENTITY owl "http://www.w3.org/2002/07/owl#" >
    <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
    <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" >
    <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
    <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
    <!ENTITY Ontology1259797020687 "http://www.semanticweb.org/ontologies/2009/11/3/Ontology1259797020687.owl#" >
]>

<rdf:RDF xmlns="http://www.semanticweb.org/ontologies/2009/11/3/Ontology1259797020687.owl#"
     xml:base="http://www.semanticweb.org/ontologies/2009/11/3/Ontology1259797020687.owl"
     xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#"
     xmlns:Ontology1259797020687="http://www.semanticweb.org/ontologies/2009/11/3/Ontology1259797020687.owl#"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:owl="http://www.w3.org/2002/07/owl#">
    <owl:Ontology rdf:about=""/>

   <!--Data properties-->

    <!-- http://www.semanticweb.org/ontologies/2009/11/3/Ontology1259797020687.owl#pl -->

    <owl:DatatypeProperty rdf:about="#pl">
        <rdfs:range rdf:resource="&xsd;string"/>
    </owl:DatatypeProperty>
    
    <!-- http://www.semanticweb.org/ontologies/2009/11/3/Ontology1259797020687.owl#sklad -->

    <owl:DatatypeProperty rdf:about="#sklad">
        <rdfs:range rdf:resource="&xsd;float"/>
    </owl:DatatypeProperty>
    
    <!--Classes-->

    <!-- http://www.semanticweb.org/ontologies/2009/11/3/Ontology1259797020687.owl#auto -->
    <owl:Class rdf:about="#auto"/>

    <!-- http://www.semanticweb.org/ontologies/2009/11/3/Ontology1259797020687.owl#focus -->
    <owl:Class rdf:about="#focus">
        <rdfs:subClassOf rdf:resource="#osobowe"/>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="#sklad"/>
                <owl:someValuesFrom>
                    <rdf:Description>
                        <rdf:type rdf:resource="&rdfs;Datatype"/>
                        <owl:onDatatype rdf:resource="&xsd;float"/>
                        <owl:withRestrictions rdf:parseType="Collection">
                            <rdf:Description>
                                <xsd:maxInclusive rdf:datatype="&xsd;double">9.0</xsd:maxInclusive>
                            </rdf:Description>
                            <rdf:Description>
                                <xsd:minInclusive rdf:datatype="&xsd;double">5.0</xsd:minInclusive>
                            </rdf:Description>
                        </owl:withRestrictions>
                    </rdf:Description>
                </owl:someValuesFrom>
            </owl:Restriction>
        </rdfs:subClassOf>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="#pl"/>
                <owl:hasValue>hajsha123</owl:hasValue>
            </owl:Restriction>
        </rdfs:subClassOf>
    </owl:Class>
    
    <!-- http://www.semanticweb.org/ontologies/2009/11/3/Ontology1259797020687.owl#osobowe -->
    <owl:Class rdf:about="#osobowe">
        <rdfs:subClassOf rdf:resource="#auto"/>
    </owl:Class>
    
    <!-- http://www.semanticweb.org/ontologies/2009/11/3/Ontology1259797020687.owl#scania -->
    <owl:Class rdf:about="#scania">
        <rdfs:subClassOf rdf:resource="#tir"/>
        <rdfs:subClassOf>
            <owl:Class>
                <owl:intersectionOf rdf:parseType="Collection">
                    <owl:Restriction>
                        <owl:onProperty rdf:resource="#sklad"/>
                        <owl:someValuesFrom>
                            <rdf:Description>
                                <rdf:type rdf:resource="&rdfs;Datatype"/>
                                <owl:onDatatype rdf:resource="&xsd;float"/>
                                <owl:withRestrictions rdf:parseType="Collection">
                                    <rdf:Description>
                                        <xsd:minInclusive rdf:datatype="&xsd;integer">10</xsd:minInclusive>
                                    </rdf:Description>
                                    <rdf:Description>
                                        <xsd:maxInclusive rdf:datatype="&xsd;integer">30</xsd:maxInclusive>
                                    </rdf:Description>
                                </owl:withRestrictions>
                            </rdf:Description>
                        </owl:someValuesFrom>
                    </owl:Restriction>
                    <owl:Restriction>
                        <owl:onProperty rdf:resource="#pl"/>
                        <owl:hasValue>sdfs231</owl:hasValue>
                    </owl:Restriction>
                </owl:intersectionOf>
            </owl:Class>
        </rdfs:subClassOf>
    </owl:Class>
    
<!-- http://www.semanticweb.org/ontologies/2009/11/3/Ontology1259797020687.owl#tir -->
    <owl:Class rdf:about="#tir">
        <rdfs:subClassOf rdf:resource="#auto"/>
    </owl:Class>
</rdf:RDF>


Przyda się każda nawet najmniejsza wskazówka
Ewentualnie tak myśle że może do bazy danych by to zapisać dane a później generować xml?? Co Wy na to??
Dzięki z góry

A może ktoś wie czy SIMPLEXML nadaje sie do obróbki rdf czy możliwa jest wogóle przetwarzanie tego typu plików??
Lino
Hej

Dobrym narzędziem do zabawy z plikami RDF w PHP jest ARC (ARC Classses for PHP) lub też RAP API. Mają funkcje, które umożliwiają wykonywanie zapytań w języku SPARQL na tych grafach i odpowiednie dalsze przekształcenia. Poczytaj trochę ich dokumentacje. Parę przykładów możesz znaleźć też na semantictechnology.eu
adawo
Nie wiem czy dobrze zrozumiałem problem, ale...
Czy RDF nie jest poprawną aplikacją XMLa ? Jeżeli tak to łatwo ją możesz przekształcić w innym dokument XMLa za pomocą XSTLa...
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.