what is the problem here to add a customized built-in?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

what is the problem here to add a customized built-in?

Yu Zhang
Dear Expert:
   I want to add a customized builtin mybuiltins:matchrouteColor() following
the
guideline:https://github.com/protegeproject/swrlapi/wiki/SWRLBuiltInBridge#Defining_BuiltIns_in_Java

also define the new builtin in an ontology Untiled-4.owl as following:
 <?xml version="1.0"?>
<Ontology xmlns="http://www.w3.org/2002/07/owl#"
   
xml:base="http://www.semanticweb.org/yuzhan/ontologies/2019/6/untitled-ontology-33"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:xml="http://www.w3.org/XML/1998/namespace"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
   
ontologyIRI="http://www.semanticweb.org/yuzhan/ontologies/2019/6/untitled-ontology-33">
    <Prefix name=""
IRI="http://www.semanticweb.org/yuzhan/ontologies/2019/6/untitled-ontology-33#"/>
    <Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/>
    <Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
    <Prefix name="xml" IRI="http://www.w3.org/XML/1998/namespace"/>
    <Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/>
    <Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/>
    <Declaration>
        <Class IRI="http://www.w3.org/2003/11/swrl#Builtin"/>
    </Declaration>
    <Declaration>
        <NamedIndividual IRI="#matchrouteColor"/>
    </Declaration>
    <ClassAssertion>
        <Class IRI="http://www.w3.org/2003/11/swrl#Builtin"/>
        <NamedIndividual IRI="#matchrouteColor"/>
    </ClassAssertion>
</Ontology>


I import the Untitled-4.owl into pretege5.5.0 as following:
<http://protege-project.136.n4.nabble.com/file/t376036/Screen_Shot_2019-07-27_at_9.png>
and save my new ontology as Untitled-5.owl as following:
<?xml version="1.0"?>
<Ontology xmlns="http://www.w3.org/2002/07/owl#"
   
xml:base="http://www.semanticweb.org/yuzhan/ontologies/2019/6/untitled-ontology-34"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:xml="http://www.w3.org/XML/1998/namespace"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
   
ontologyIRI="http://www.semanticweb.org/yuzhan/ontologies/2019/6/untitled-ontology-34">
    <Prefix name=""
IRI="http://www.semanticweb.org/yuzhan/ontologies/2019/6/untitled-ontology-34#"/>
    <Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/>
    <Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
    <Prefix name="xml" IRI="http://www.w3.org/XML/1998/namespace"/>
    <Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/>
    <Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/>
    <Prefix name="mybuiltins"
IRI="http://www.semanticweb.org/yuzhan/ontologies/2019/6/untitled-ontology-33#"/>
   
<Import>http://www.semanticweb.org/yuzhan/ontologies/2019/6/untitled-ontology-33</Import>
    <Declaration>
        <Class IRI="http://www.test.com/test#Adult"/>
    </Declaration>
    <Declaration>
        <Class IRI="http://www.test.com/test#Person"/>
    </Declaration>
</Ontology>


but when I try to add a new rule with this new added builtin, I always meet
the following error:
"Invalid SWRL atom predicate 'mybuiltins:matchrouteColor'"

what the problem here?




--
Sent from: http://protege-project.136.n4.nabble.com/Protege-Developer-f4659816.html
_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev
Reply | Threaded
Open this post in threaded view
|

Re: what is the problem here to add a customized built-in?

Yu Zhang
by the way, I implement the java code under
public class SWRLBuiltInLibraryImpl extends AbstractSWRLBuiltInLibrary
{
......
public boolean matchrouteColor(List<SWRLBuiltInArgument> arguments) throws
SWRLBuiltInException

....
}

and put the .jar under Protege-5.5.0/Protégé.app/Contents/Java/plugins/





--
Sent from: http://protege-project.136.n4.nabble.com/Protege-Developer-f4659816.html
_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev
Reply | Threaded
Open this post in threaded view
|

Re: what is the problem here to add a customized built-in?

Yu Zhang
In reply to this post by Yu Zhang
I also check the
http://protege-project.136.n4.nabble.com/Custom-Builtin-Creation-td4666078.html#a4666083,
still not know what the problem for me to add my new built in.



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-Developer-f4659816.html
_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev
Reply | Threaded
Open this post in threaded view
|

Re: what is the problem here to add a customized built-in?

Yu Zhang
In reply to this post by Yu Zhang
capture the error page as following when try to use this new builtin in a
rule:
<http://protege-project.136.n4.nabble.com/file/t376036/Screen_Shot_2019-07-28_at_8.png>



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-Developer-f4659816.html
_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev
Reply | Threaded
Open this post in threaded view
|

Re: what is the problem here to add a customized built-in?

Martin O'Connor-2

I will take a looks this week. I looks like you are performing the correct actions.

Martin

> On Jul 27, 2019, at 5:06 PM, Yu Zhang <[hidden email]> wrote:
>
> capture the error page as following when try to use this new builtin in a
> rule:
> <http://protege-project.136.n4.nabble.com/file/t376036/Screen_Shot_2019-07-28_at_8.png>
>
>
>
> --
> Sent from: http://protege-project.136.n4.nabble.com/Protege-Developer-f4659816.html
> _______________________________________________
> protege-dev mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-dev


_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev