добавление отдельных лиц в онтологию сов с помощью запроса SPARQL с автономным сервером apache jeja fuseki - PullRequest
0 голосов
/ 26 апреля 2020

У меня простая лекарственная онтология. Я хочу добавить человека с помощью запроса SPARQL, используя apache автономный сервер jena. the drug.owl:

    <?xml version="1.0"?>
<rdf:RDF xmlns="http://s11.picofile.com/d/8393556000/d9191f89-321e-4dc8-951a-a1385b365251/drugs.owl#"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:owlr="http://www.lesfleursdunormal.fr/static/_downloads/owlready_ontology.owl#"
         xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
         xmlns:owl="http://www.w3.org/2002/07/owl#"
         xml:base="http://s11.picofile.com/d/8393556000/d9191f89-321e-4dc8-951a-a1385b365251/drugs.owl">

<owl:Ontology rdf:about="http://s11.picofile.com/d/8393556000/d9191f89-321e-4dc8-951a-a1385b365251/drugs.owl"/>

<owl:ObjectProperty rdf:about="#has_for_active_principle">
  <rdfs:domain rdf:resource="#Drug"/>
  <rdfs:range rdf:resource="#ActivePrinciple"/>
  <owlr:python_name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">active_principles</owlr:python_name>
</owl:ObjectProperty>

<owl:Class rdf:about="#Drug">
  <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
  <rdfs:subClassOf>
    <owl:Class>
      <owl:oneOf rdf:parseType="Collection">
        <rdf:Description rdf:about="#drug3"/>
        <rdf:Description rdf:about="#drug1"/>
        <rdf:Description rdf:about="#drug2"/>
    <rdf:Description rdf:about="#drug4" />
      </owl:oneOf>
    </owl:Class>
  </rdfs:subClassOf>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#has_for_active_principle"/>
      <owl:allValuesFrom>
        <owl:Class>
          <owl:unionOf rdf:parseType="Collection">
            <rdf:Description rdf:about="#ActivePrinciple"/>
            <rdf:Description rdf:about="#ActivePrinciple"/>
            <owl:Class>
              <owl:oneOf rdf:parseType="Collection">
                <rdf:Description rdf:about="#acetaminophen"/>
                <rdf:Description rdf:about="#amoxicillin"/>
                <rdf:Description rdf:about="#clavulanic_acid"/>
              </owl:oneOf>
            </owl:Class>
          </owl:unionOf>
        </owl:Class>
      </owl:allValuesFrom>
    </owl:Restriction>
  </rdfs:subClassOf>
  <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">it's for healthcare</rdfs:comment>
  <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">it fights with pains</rdfs:comment>
</owl:Class>

<owl:Class rdf:about="#ActivePrinciple">
  <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
</owl:Class>

<owl:Class rdf:about="#Placebo">
  <rdfs:subClassOf rdf:resource="#Drug"/>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#has_for_active_principle"/>
      <owl:allValuesFrom rdf:resource="http://www.w3.org/2002/07/owl#Nothing"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <owl:equivalentClass>
    <owl:Class>
      <owl:intersectionOf rdf:parseType="Collection">
        <rdf:Description rdf:about="#Drug"/>
        <owl:Class>
          <owl:complementOf>
            <owl:Restriction>
              <owl:onProperty rdf:resource="#has_for_active_principle"/>
              <owl:someValuesFrom rdf:resource="#ActivePrinciple"/>
            </owl:Restriction>
          </owl:complementOf>
        </owl:Class>
      </owl:intersectionOf>
    </owl:Class>
  </owl:equivalentClass>
</owl:Class>

<owl:Class rdf:about="#SingleActivePrincipleDrug">
  <rdfs:subClassOf rdf:resource="#Drug"/>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#has_for_active_principle"/>
      <owl:allValuesFrom rdf:resource="#ActivePrinciple"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <owl:equivalentClass>
    <owl:Class>
      <owl:intersectionOf rdf:parseType="Collection">
        <rdf:Description rdf:about="#Drug"/>
        <owl:Restriction>
          <owl:onProperty rdf:resource="#has_for_active_principle"/>
          <owl:onClass rdf:resource="#ActivePrinciple"/>
          <owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:qualifiedCardinality>
        </owl:Restriction>
      </owl:intersectionOf>
    </owl:Class>
  </owl:equivalentClass>
</owl:Class>

<owl:Class rdf:about="#DrugAssociation">
  <rdfs:subClassOf rdf:resource="#Drug"/>
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#has_for_active_principle"/>
      <owl:allValuesFrom rdf:resource="#ActivePrinciple"/>
    </owl:Restriction>
  </rdfs:subClassOf>
  <owl:equivalentClass>
    <owl:Class>
      <owl:intersectionOf rdf:parseType="Collection">
        <rdf:Description rdf:about="#Drug"/>
        <owl:Restriction>
          <owl:onProperty rdf:resource="#has_for_active_principle"/>
          <owl:onClass rdf:resource="#ActivePrinciple"/>
          <owl:minQualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">2</owl:minQualifiedCardinality>
        </owl:Restriction>
      </owl:intersectionOf>
    </owl:Class>
  </owl:equivalentClass>
</owl:Class>

<ActivePrinciple rdf:about="#acetaminophen">
  <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
</ActivePrinciple>

<ActivePrinciple rdf:about="#amoxicillin">
  <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
</ActivePrinciple>

<ActivePrinciple rdf:about="#clavulanic_acid">
  <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
</ActivePrinciple>

<Drug rdf:about="#drug1">
  <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
  <rdf:type>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#has_for_active_principle"/>
      <owl:allValuesFrom>
        <owl:Class>
          <owl:oneOf rdf:parseType="Collection">
            <rdf:Description rdf:about="#acetaminophen"/>
          </owl:oneOf>
        </owl:Class>
      </owl:allValuesFrom>
    </owl:Restriction>
  </rdf:type>
  <has_for_active_principle rdf:resource="#acetaminophen"/>
</Drug>

<Drug rdf:about="#drug2">
  <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
  <rdf:type>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#has_for_active_principle"/>
      <owl:allValuesFrom>
        <owl:Class>
          <owl:oneOf rdf:parseType="Collection">
            <rdf:Description rdf:about="#amoxicillin"/>
            <rdf:Description rdf:about="#clavulanic_acid"/>
          </owl:oneOf>
        </owl:Class>
      </owl:allValuesFrom>
    </owl:Restriction>
  </rdf:type>
  <has_for_active_principle rdf:resource="#amoxicillin"/>
  <has_for_active_principle rdf:resource="#clavulanic_acid"/>
</Drug>

<Drug rdf:about="#drug3">
  <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
  <rdf:type>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#has_for_active_principle"/>
      <owl:allValuesFrom rdf:resource="http://www.w3.org/2002/07/owl#Nothing"/>
    </owl:Restriction>
  </rdf:type>
</Drug>

<Drug rdf:about="#drug4">
  <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
  <rdf:type>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#has_for_active_principle"/>
      <owl:allValuesFrom rdf:resource="http://www.w3.org/2002/07/owl#Nothing"/>
    </owl:Restriction>
  </rdf:type>
</Drug>

<owl:AllDifferent>
  <owl:distinctMembers rdf:parseType="Collection">
    <rdf:Description rdf:about="#acetaminophen"/>
    <rdf:Description rdf:about="#amoxicillin"/>
    <rdf:Description rdf:about="#clavulanic_acid"/>
  </owl:distinctMembers>
</owl:AllDifferent>


</rdf:RDF>

Я хочу добавить лекарство и посмотреть измененную онтологию в Protege. что такое запрос и как я могу добавить нового человека в мою существующую онтологию? Я хочу сделать это только с помощью запроса sparql и автономного сервера apache jena. у кого есть идея? спасибо

...